Skip to content

Commit abdd15f

Browse files
committed
globalObjects option to config
1 parent 182eea3 commit abdd15f

File tree

4 files changed

+20
-3
lines changed

4 files changed

+20
-3
lines changed

config.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@ module.exports = new (require("./types/Config"))({
1616
// Ulaşmak için "Underline.config.other" objesini kullanabilirsiniz.
1717
other: {
1818

19+
},
20+
// Otomatik olarak "Underline" objesinin içine eklenen değerler.
21+
// Eklediğiniz değerler "Underline.<anahtar>" şeklinde ulaşabilirsiniz.
22+
// Prejeinin herhangi bir yerinde bu işlemi yapabilirsiniz.
23+
// Bu obje hiçbir filitrelemeden geçmemektedir. "Başınız yanabilir."
24+
// - Bu özellik other objesinin bi amacı kalmamasını sağlıyor
25+
globalObjects: {
26+
1927
},
2028
// Kullanıcı hatalarındaki uyarı mesajları/olayları.
2129
userErrors: {

globals.d.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ interface Underline {
99
SlashCommand: typeof import("./types/SlashCommand"),
1010
MessageAction: typeof import("./types/MessageAction"),
1111
UserAction: typeof import("./types/UserAction"),
12-
Event: typeof import("./types/Event")
12+
Event: typeof import("./types/Event"),
13+
14+
[key: string | number]: any,
1315
}
1416

1517

index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
require("./other/patchConsoleLog");
22
const config = require("./config");
3+
globalThis.Underline = config.globalObjects;
34
const Discord = require("discord.js");
45
const chillout = require("chillout");
56
const path = require("path");
@@ -11,6 +12,7 @@ const interactions = new Discord.Collection();
1112
const events = new Discord.Collection();
1213

1314
globalThis.Underline = {
15+
...config.globalObjects,
1416
config,
1517
client,
1618
interactions,

types/Config.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ class Config {
2121
/** @type {Command} */
2222
interactionDefaults = {};
2323

24-
/** @type {Set<string>} */
24+
/** @type {Set<string> | Array<string>} */
2525
blockedUsers = new Set();
2626

27-
/** @type {Set<string>} */
27+
/** @type {Set<string> | Array<string>} */
2828
developers = new Set();
2929

3030
/** @type {(client:import("discord.js").Client)=>void} */
@@ -42,6 +42,9 @@ class Config {
4242
/** @type {(interaction:Command, interaction: Discord.CommandInteraction, other: {setCoolDown(duration:number): void, [key:string|number]: any})=>boolean} */
4343
onInteraction = async () => { return true; };
4444

45+
/** @type {{[key: string|number]: any}} */
46+
globalObjects = {};
47+
4548
/**
4649
* @param {Config} arg
4750
*/
@@ -102,6 +105,8 @@ class Config {
102105
arg.developers instanceof Set
103106
) this.developers = new Set([...arg.developers]);
104107

108+
this.globalObjects = arg.globalObjects;
109+
105110
if (typeof arg.onBeforeLoad == "function") this.onBeforeLoad = arg.onBeforeLoad;
106111
if (typeof arg.onAfterLoad == "function") this.onAfterLoad = arg.onAfterLoad;
107112
if (typeof arg.onReady == "function") this.onReady = arg.onReady;

0 commit comments

Comments
 (0)