xernerx 4.4.13 → 4.4.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/build/ContextCommandBuilder.d.ts +31 -23
- package/dist/build/ContextCommandBuilder.js +39 -39
- package/dist/build/EventBuilder.d.ts +1 -1
- package/dist/build/EventBuilder.js +2 -2
- package/dist/build/InhibitorBuilder.d.ts +1 -1
- package/dist/build/InhibitorBuilder.js +2 -2
- package/dist/build/MessageCommandBuilder.d.ts +26 -20
- package/dist/build/MessageCommandBuilder.js +34 -34
- package/dist/build/SlashCommandBuilder.d.ts +31 -23
- package/dist/build/SlashCommandBuilder.js +48 -48
- package/dist/client/XernerxClient.d.ts +30 -22
- package/dist/client/XernerxClient.js +33 -33
- package/dist/client/XernerxShardClient.d.ts +1 -1
- package/dist/client/XernerxShardClient.d.ts.map +1 -1
- package/dist/client/XernerxShardClient.js +18 -12
- package/dist/client/XernerxShardClient.js.map +1 -1
- package/dist/functions/delay.d.ts +1 -1
- package/dist/functions/delay.js +1 -1
- package/dist/functions/deploy.d.ts +1 -1
- package/dist/functions/deploy.js +13 -16
- package/dist/functions/isOwner.d.ts +1 -1
- package/dist/functions/isOwner.js +1 -1
- package/dist/functions/isVoter.d.ts +1 -1
- package/dist/functions/isVoter.js +1 -1
- package/dist/functions/load.d.ts +1 -1
- package/dist/functions/load.js +2 -3
- package/dist/functions/reload.d.ts +1 -1
- package/dist/functions/reload.js +9 -12
- package/dist/functions/sendWebhook.d.ts +1 -1
- package/dist/functions/sendWebhook.js +2 -3
- package/dist/functions/setPresence.d.ts +2 -2
- package/dist/functions/setPresence.js +12 -11
- package/dist/functions/xernerxUser.d.ts +1 -1
- package/dist/functions/xernerxUser.js +1 -1
- package/dist/handlers/CommandHandler.d.ts +1 -1
- package/dist/handlers/CommandHandler.js +82 -105
- package/dist/handlers/EventHandler.d.ts +1 -1
- package/dist/handlers/EventHandler.js +3 -3
- package/dist/handlers/ExtensionHandler.d.ts +1 -1
- package/dist/handlers/ExtensionHandler.js +3 -5
- package/dist/handlers/Handler.d.ts +1 -1
- package/dist/handlers/Handler.js +6 -16
- package/dist/handlers/InhibitorHandler.d.ts +1 -1
- package/dist/handlers/InhibitorHandler.js +3 -3
- package/dist/handlers/WebhookHandler.d.ts +2 -4
- package/dist/handlers/WebhookHandler.js +9 -6
- package/dist/main.d.ts +29 -22
- package/dist/main.js +29 -22
- package/dist/models/Arguments.d.ts +1 -1
- package/dist/models/Arguments.js +48 -63
- package/dist/tools/XernerxError.d.ts +1 -1
- package/dist/tools/XernerxError.js +1 -1
- package/dist/tools/XernerxLog.d.ts +1 -1
- package/dist/tools/XernerxLog.js +7 -2
- package/dist/types/extenders.d.ts +5 -9
- package/dist/types/extenders.js +1 -1
- package/dist/types/interfaces.d.ts +9 -6
- package/dist/types/interfaces.js +1 -1
- package/dist/types/types.d.ts +174 -6
- package/dist/types/types.js +1 -1
- package/dist/utils/ClientUtil.d.ts +4 -4
- package/dist/utils/ClientUtil.js +8 -14
- package/dist/utils/InteractionUtil.d.ts +2 -2
- package/dist/utils/InteractionUtil.js +1 -1
- package/dist/utils/MessageUtil.d.ts +2 -2
- package/dist/utils/MessageUtil.js +5 -9
- package/dist/utils/Util.d.ts +1 -1
- package/dist/utils/Util.js +1 -1
- package/dist/validators/commandValidation.d.ts +1 -1
- package/dist/validators/commandValidation.js +19 -29
- package/dist/validators/inhibitorValidations.d.ts +15 -2
- package/dist/validators/inhibitorValidations.js +1 -1
- package/package.json +1 -1
|
@@ -15,28 +15,26 @@ export default class CommandHandler extends Handler {
|
|
|
15
15
|
super(client);
|
|
16
16
|
}
|
|
17
17
|
loadMessageCommands(options) {
|
|
18
|
-
if (!this.client.options.intents.has(GatewayIntentBits.MessageContent))
|
|
19
|
-
|
|
20
|
-
if (!this.client.options.intents.has(GatewayIntentBits.GuildMessages))
|
|
21
|
-
new XernerxLog(this.client).warn(`Message commands might not work as you're missing the intent GuildMessages!`);
|
|
18
|
+
if (!this.client.options.intents.has(GatewayIntentBits.MessageContent)) new XernerxLog(this.client).warn(`Message commands might not work as you're missing the intent MessageContent!`);
|
|
19
|
+
if (!this.client.options.intents.has(GatewayIntentBits.GuildMessages)) new XernerxLog(this.client).warn(`Message commands might not work as you're missing the intent GuildMessages!`);
|
|
22
20
|
options = z
|
|
23
21
|
.object({
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
22
|
+
directory: z.string(),
|
|
23
|
+
prefix: z.string().or(z.array(z.string())),
|
|
24
|
+
allowMention: z.boolean().default(false),
|
|
25
|
+
cooldown: z.number().default(0),
|
|
26
|
+
permissions: z
|
|
27
|
+
.object({
|
|
28
|
+
user: z.array(z.string()).default([]),
|
|
29
|
+
client: z.array(z.string()).default([]),
|
|
30
|
+
dm: z.boolean().default(true),
|
|
31
|
+
})
|
|
32
|
+
.default({}),
|
|
33
|
+
handleEdits: z.boolean().default(false),
|
|
34
|
+
handleDeletes: z.boolean().default(false),
|
|
35
|
+
handleTyping: z.boolean().default(false),
|
|
36
|
+
logging: z.boolean().default(false),
|
|
33
37
|
})
|
|
34
|
-
.default({}),
|
|
35
|
-
handleEdits: z.boolean().default(false),
|
|
36
|
-
handleDeletes: z.boolean().default(false),
|
|
37
|
-
handleTyping: z.boolean().default(false),
|
|
38
|
-
logging: z.boolean().default(false),
|
|
39
|
-
})
|
|
40
38
|
.parse(options);
|
|
41
39
|
this.client.modules.options.message = options;
|
|
42
40
|
const files = this.readdir(options.directory);
|
|
@@ -65,28 +63,27 @@ export default class CommandHandler extends Handler {
|
|
|
65
63
|
// return reload(this.client, 'message');
|
|
66
64
|
// }
|
|
67
65
|
loadSlashCommands(options) {
|
|
68
|
-
if (!this.client.settings.local)
|
|
69
|
-
new XernerxLog(this.client).warn(`Slash commands might not work as you haven't specified a local guild ID.`);
|
|
66
|
+
if (!this.client.settings.local) new XernerxLog(this.client).warn(`Slash commands might not work as you haven't specified a local guild ID.`);
|
|
70
67
|
options = z
|
|
71
68
|
.object({
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
69
|
+
directory: z.string(),
|
|
70
|
+
cooldown: z.number().default(0),
|
|
71
|
+
permissions: z
|
|
72
|
+
.object({
|
|
73
|
+
user: z.array(z.string()).default([]),
|
|
74
|
+
client: z.array(z.string()).default([]),
|
|
75
|
+
dm: z.boolean().default(true),
|
|
76
|
+
})
|
|
77
|
+
.default({}),
|
|
78
|
+
logging: z.boolean().default(false),
|
|
79
|
+
defer: z
|
|
80
|
+
.object({
|
|
81
|
+
reply: z.boolean().default(false),
|
|
82
|
+
ephemeral: z.boolean().default(false),
|
|
83
|
+
fetchReply: z.boolean().default(false),
|
|
84
|
+
})
|
|
85
|
+
.default({}),
|
|
87
86
|
})
|
|
88
|
-
.default({}),
|
|
89
|
-
})
|
|
90
87
|
.parse(options);
|
|
91
88
|
this.client.modules.options.slash = options;
|
|
92
89
|
const files = this.readdir(options.directory);
|
|
@@ -103,28 +100,27 @@ export default class CommandHandler extends Handler {
|
|
|
103
100
|
});
|
|
104
101
|
}
|
|
105
102
|
loadContextCommands(options) {
|
|
106
|
-
if (!this.client.settings.local)
|
|
107
|
-
new XernerxLog(this.client).warn(`Context commands might not work as you haven't specified a local guild ID.`);
|
|
103
|
+
if (!this.client.settings.local) new XernerxLog(this.client).warn(`Context commands might not work as you haven't specified a local guild ID.`);
|
|
108
104
|
options = z
|
|
109
105
|
.object({
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
106
|
+
directory: z.string(),
|
|
107
|
+
cooldown: z.number().default(0),
|
|
108
|
+
permissions: z
|
|
109
|
+
.object({
|
|
110
|
+
user: z.array(z.string()).default([]),
|
|
111
|
+
client: z.array(z.string()).default([]),
|
|
112
|
+
dm: z.boolean().default(true),
|
|
113
|
+
})
|
|
114
|
+
.default({}),
|
|
115
|
+
logging: z.boolean().default(false),
|
|
116
|
+
defer: z
|
|
117
|
+
.object({
|
|
118
|
+
reply: z.boolean().default(false),
|
|
119
|
+
ephemeral: z.boolean().default(false),
|
|
120
|
+
fetchReply: z.boolean().default(false),
|
|
121
|
+
})
|
|
122
|
+
.default({}),
|
|
117
123
|
})
|
|
118
|
-
.default({}),
|
|
119
|
-
logging: z.boolean().default(false),
|
|
120
|
-
defer: z
|
|
121
|
-
.object({
|
|
122
|
-
reply: z.boolean().default(false),
|
|
123
|
-
ephemeral: z.boolean().default(false),
|
|
124
|
-
fetchReply: z.boolean().default(false),
|
|
125
|
-
})
|
|
126
|
-
.default({}),
|
|
127
|
-
})
|
|
128
124
|
.parse(options);
|
|
129
125
|
this.client.modules.options.context = options;
|
|
130
126
|
const files = this.readdir(options.directory);
|
|
@@ -142,18 +138,14 @@ export default class CommandHandler extends Handler {
|
|
|
142
138
|
}
|
|
143
139
|
async messageCommandRun(message, message2) {
|
|
144
140
|
const filetype = 'MessageCommand';
|
|
145
|
-
if (message.author.bot)
|
|
146
|
-
return;
|
|
141
|
+
if (message.author.bot) return;
|
|
147
142
|
message.util = new MessageUtil(this.client, message);
|
|
148
143
|
message.user = await xernerxUser(message, this.client);
|
|
149
|
-
if (typeof message2 === 'object')
|
|
150
|
-
message = message2;
|
|
144
|
+
if (typeof message2 === 'object') message = message2;
|
|
151
145
|
if (message2 === 'delete') {
|
|
152
|
-
if (!this.client.cache.messages.has(message.id))
|
|
153
|
-
return;
|
|
146
|
+
if (!this.client.cache.messages.has(message.id)) return;
|
|
154
147
|
const id = this.client.cache.messages.get(message.id);
|
|
155
|
-
if (!id)
|
|
156
|
-
return;
|
|
148
|
+
if (!id) return;
|
|
157
149
|
(async () => {
|
|
158
150
|
const msg = await message.channel.messages.fetch(id);
|
|
159
151
|
await msg.delete();
|
|
@@ -164,25 +156,24 @@ export default class CommandHandler extends Handler {
|
|
|
164
156
|
if (message.content && this.client.modules.options.message) {
|
|
165
157
|
const commands = this.client.commands.message;
|
|
166
158
|
const prefixes = Array.isArray(this.client.modules.options.message.prefix) ? this.client.modules.options.message.prefix : [this.client.modules.options.message.prefix];
|
|
167
|
-
let commandName = null,
|
|
159
|
+
let commandName = null,
|
|
160
|
+
cmd,
|
|
161
|
+
commandAlias = null,
|
|
162
|
+
commandPrefix = null;
|
|
168
163
|
commands.map((command) => {
|
|
169
164
|
let prefix = null;
|
|
170
165
|
if (command.regex && message.content.match(command.regex)) {
|
|
171
166
|
const [match] = message.content.match(command.regex) || [null];
|
|
172
|
-
if (match)
|
|
173
|
-
commandName = command.name;
|
|
167
|
+
if (match) commandName = command.name;
|
|
174
168
|
}
|
|
175
169
|
const cp = Array.isArray(command.prefix) ? command.prefix : [command.prefix];
|
|
176
170
|
prefixes.map((p) => {
|
|
177
|
-
if (message.content.startsWith(p))
|
|
178
|
-
prefix = p;
|
|
171
|
+
if (message.content.startsWith(p)) prefix = p;
|
|
179
172
|
});
|
|
180
173
|
cp.map((p) => {
|
|
181
|
-
if (message.content.startsWith(p))
|
|
182
|
-
prefix = p;
|
|
174
|
+
if (message.content.startsWith(p)) prefix = p;
|
|
183
175
|
});
|
|
184
|
-
if (!prefix)
|
|
185
|
-
return;
|
|
176
|
+
if (!prefix) return;
|
|
186
177
|
if (!commandName)
|
|
187
178
|
commandName =
|
|
188
179
|
message.content
|
|
@@ -203,12 +194,9 @@ export default class CommandHandler extends Handler {
|
|
|
203
194
|
commandName = message.content.replace(`<@${this.client.user?.id}>`, '').trim().split(/ +/).shift()?.toLowerCase() || null;
|
|
204
195
|
}
|
|
205
196
|
}
|
|
206
|
-
if (this.client.commands.message.has(commandName))
|
|
207
|
-
|
|
208
|
-
if (
|
|
209
|
-
return;
|
|
210
|
-
if (!cmd)
|
|
211
|
-
return this.client.emit('commandNotFound', message, filetype);
|
|
197
|
+
if (this.client.commands.message.has(commandName)) cmd = this.client.commands.message.get(commandName);
|
|
198
|
+
if (await inhibitorValidation(message, cmd)) return;
|
|
199
|
+
if (!cmd) return this.client.emit('commandNotFound', message, filetype);
|
|
212
200
|
message.util.parsed = {
|
|
213
201
|
alias: commandAlias,
|
|
214
202
|
prefix: commandPrefix,
|
|
@@ -222,25 +210,20 @@ export default class CommandHandler extends Handler {
|
|
|
222
210
|
interaction.util = new InteractionUtil(this.client, interaction);
|
|
223
211
|
interaction.user = await xernerxUser(interaction, this.client);
|
|
224
212
|
let cmd = null;
|
|
225
|
-
if (this.client.commands.slash.has(interaction.commandName))
|
|
226
|
-
|
|
227
|
-
if (
|
|
228
|
-
return;
|
|
229
|
-
if (!cmd)
|
|
230
|
-
return this.client.emit('commandNotFound', interaction);
|
|
213
|
+
if (this.client.commands.slash.has(interaction.commandName)) cmd = this.client.commands.slash.get(interaction.commandName);
|
|
214
|
+
if (await inhibitorValidation(interaction, cmd)) return;
|
|
215
|
+
if (!cmd) return this.client.emit('commandNotFound', interaction);
|
|
231
216
|
new Promise(async (resolve) => {
|
|
232
217
|
if (interaction.isAutocomplete()) {
|
|
233
218
|
const focused = interaction.options.getFocused(true);
|
|
234
219
|
const options = interaction.options;
|
|
235
220
|
await cmd.autocomplete(interaction, focused, options);
|
|
236
|
-
}
|
|
237
|
-
else
|
|
238
|
-
resolve(true);
|
|
221
|
+
} else resolve(true);
|
|
239
222
|
})
|
|
240
223
|
.then(async () => {
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
224
|
+
this.client.emit('commandStart', interaction, filetype);
|
|
225
|
+
await this.exec(cmd, interaction, await interactionArguments(interaction, cmd), filetype);
|
|
226
|
+
})
|
|
244
227
|
.catch((error) => this.client.emit('commandError', interaction, error, filetype));
|
|
245
228
|
}
|
|
246
229
|
async contextCommandRun(interaction) {
|
|
@@ -248,28 +231,22 @@ export default class CommandHandler extends Handler {
|
|
|
248
231
|
interaction.util = new InteractionUtil(this.client, interaction);
|
|
249
232
|
interaction.user = await xernerxUser(interaction, this.client);
|
|
250
233
|
let cmd;
|
|
251
|
-
if (this.client.commands.context.has(interaction.commandName))
|
|
252
|
-
|
|
253
|
-
if (
|
|
254
|
-
return;
|
|
255
|
-
if (!cmd)
|
|
256
|
-
return this.client.emit('commandNotFound', interaction, filetype);
|
|
234
|
+
if (this.client.commands.context.has(interaction.commandName)) cmd = this.client.commands.context.get(interaction.commandName);
|
|
235
|
+
if (await inhibitorValidation(interaction, cmd)) return;
|
|
236
|
+
if (!cmd) return this.client.emit('commandNotFound', interaction, filetype);
|
|
257
237
|
this.client.emit('commandStart', interaction, filetype);
|
|
258
238
|
return this.exec(cmd, interaction, await interactionArguments(interaction, cmd), filetype);
|
|
259
239
|
}
|
|
260
240
|
async exec(cmd, event, args, type) {
|
|
261
241
|
try {
|
|
262
|
-
if (await commandValidation(event, cmd))
|
|
263
|
-
|
|
264
|
-
if (cmd.conditions && (await cmd.conditions(event, args)))
|
|
265
|
-
return;
|
|
242
|
+
if (await commandValidation(event, cmd)) return;
|
|
243
|
+
if (cmd.conditions && (await cmd.conditions(event, args))) return;
|
|
266
244
|
cmd.exec(event, args);
|
|
267
245
|
this.client.emit('commandFinish', event, type);
|
|
268
|
-
}
|
|
269
|
-
catch (error) {
|
|
246
|
+
} catch (error) {
|
|
270
247
|
new XernerxLog(this.client).error(`An error occurred executing ${cmd.name}`, error);
|
|
271
248
|
this.client.emit('commandError', event, error, type);
|
|
272
249
|
}
|
|
273
250
|
}
|
|
274
251
|
}
|
|
275
|
-
//# sourceMappingURL=CommandHandler.js.map
|
|
252
|
+
//# sourceMappingURL=CommandHandler.js.map
|
|
@@ -9,8 +9,8 @@ export default class EventHandler extends Handler {
|
|
|
9
9
|
async loadEvents(options) {
|
|
10
10
|
options = z
|
|
11
11
|
.object({
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
directory: z.string(),
|
|
13
|
+
})
|
|
14
14
|
.parse(options);
|
|
15
15
|
this.client.modules.options.events = options;
|
|
16
16
|
const files = this.readdir(options.directory);
|
|
@@ -22,4 +22,4 @@ export default class EventHandler extends Handler {
|
|
|
22
22
|
new XernerxLog(this.client).info(`Loaded ${this.client.events.size} Events.`);
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
-
//# sourceMappingURL=EventHandler.js.map
|
|
25
|
+
//# sourceMappingURL=EventHandler.js.map
|
|
@@ -7,18 +7,16 @@ export default class ExtensionHandler extends Handler {
|
|
|
7
7
|
loadExtensions(...extensions) {
|
|
8
8
|
const active = extensions.map((extension) => {
|
|
9
9
|
try {
|
|
10
|
-
if (extension.main)
|
|
11
|
-
extension.main(this.client);
|
|
10
|
+
if (extension.main) extension.main(this.client);
|
|
12
11
|
if (extension.defer) {
|
|
13
12
|
this.client.on('ready', (client) => extension.defer(client));
|
|
14
13
|
}
|
|
15
14
|
return extension.name;
|
|
16
|
-
}
|
|
17
|
-
catch (error) {
|
|
15
|
+
} catch (error) {
|
|
18
16
|
return new XernerxLog(this.client).error(`An error occurred while loading ${extension.name}`, error);
|
|
19
17
|
}
|
|
20
18
|
});
|
|
21
19
|
new XernerxLog(this.client).info(`Loaded ${extensions.length} Extensions: ${active.filter((e) => e).join(', ')}`);
|
|
22
20
|
}
|
|
23
21
|
}
|
|
24
|
-
//# sourceMappingURL=ExtensionHandler.js.map
|
|
22
|
+
//# sourceMappingURL=ExtensionHandler.js.map
|
|
@@ -12,4 +12,4 @@ export default class Handler {
|
|
|
12
12
|
load(filePath: string, type: FileType): Promise<any>;
|
|
13
13
|
emit<T extends Record<string, string | boolean | Function | void>>(event: T): Promise<void>;
|
|
14
14
|
}
|
|
15
|
-
//# sourceMappingURL=Handler.d.ts.map
|
|
15
|
+
//# sourceMappingURL=Handler.d.ts.map
|
package/dist/handlers/Handler.js
CHANGED
|
@@ -13,8 +13,7 @@ export default class Handler {
|
|
|
13
13
|
readdir(dir) {
|
|
14
14
|
try {
|
|
15
15
|
return fs.readdirSync(path.resolve(dir)).filter((file) => file.endsWith('.js'));
|
|
16
|
-
}
|
|
17
|
-
catch (error) {
|
|
16
|
+
} catch (error) {
|
|
18
17
|
console.error(error);
|
|
19
18
|
}
|
|
20
19
|
return [];
|
|
@@ -25,23 +24,14 @@ export default class Handler {
|
|
|
25
24
|
return file;
|
|
26
25
|
}
|
|
27
26
|
async emit(event) {
|
|
28
|
-
if (!event?.fileType)
|
|
29
|
-
return;
|
|
27
|
+
if (!event?.fileType) return;
|
|
30
28
|
if (event.fileType === 'Event') {
|
|
31
|
-
if (event.emitter === 'client')
|
|
32
|
-
|
|
33
|
-
? this.client.once(event.name, (...args) => event.run(...args))
|
|
34
|
-
: this.client.on(event.name, (...args) => event.run(...args));
|
|
35
|
-
else if (event.emitter === 'process')
|
|
36
|
-
event.once
|
|
37
|
-
? process.once(event.name, (...args) => event.run(...args))
|
|
38
|
-
: process.on(event.name, (...args) => event.run(...args));
|
|
29
|
+
if (event.emitter === 'client') event.once ? this.client.once(event.name, (...args) => event.run(...args)) : this.client.on(event.name, (...args) => event.run(...args));
|
|
30
|
+
else if (event.emitter === 'process') event.once ? process.once(event.name, (...args) => event.run(...args)) : process.on(event.name, (...args) => event.run(...args));
|
|
39
31
|
}
|
|
40
32
|
if (['MessageCommand', 'SlashCommand', 'ContextCommand'].includes(event.fileType)) {
|
|
41
|
-
event.once
|
|
42
|
-
? this.client.once(event.name, (...args) => event.run(...args))
|
|
43
|
-
: this.client.on(event.name, (...args) => event.run(...args));
|
|
33
|
+
event.once ? this.client.once(event.name, (...args) => event.run(...args)) : this.client.on(event.name, (...args) => event.run(...args));
|
|
44
34
|
}
|
|
45
35
|
}
|
|
46
36
|
}
|
|
47
|
-
//# sourceMappingURL=Handler.js.map
|
|
37
|
+
//# sourceMappingURL=Handler.js.map
|
|
@@ -9,8 +9,8 @@ export default class InhibitorHandler extends Handler {
|
|
|
9
9
|
async loadInhibitors(options) {
|
|
10
10
|
options = z
|
|
11
11
|
.object({
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
directory: z.string(),
|
|
13
|
+
})
|
|
14
14
|
.parse(options);
|
|
15
15
|
this.client.modules.options.inhibitors = options;
|
|
16
16
|
const files = this.readdir(options.directory);
|
|
@@ -22,4 +22,4 @@ export default class InhibitorHandler extends Handler {
|
|
|
22
22
|
new XernerxLog(this.client).info(`Loaded ${this.client.inhibitors.size} Inhibitors.`);
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
-
//# sourceMappingURL=InhibitorHandler.js.map
|
|
25
|
+
//# sourceMappingURL=InhibitorHandler.js.map
|
|
@@ -2,9 +2,7 @@ import XernerxClient from '../client/XernerxClient.js';
|
|
|
2
2
|
import Handler from './Handler.js';
|
|
3
3
|
export default class WebhookHandler extends Handler {
|
|
4
4
|
constructor(client: XernerxClient);
|
|
5
|
-
loadWebhooks(options: {
|
|
6
|
-
token: string;
|
|
7
|
-
}): Promise<void>;
|
|
5
|
+
loadWebhooks(options: { token: string }): Promise<void>;
|
|
8
6
|
private post;
|
|
9
7
|
}
|
|
10
|
-
//# sourceMappingURL=WebhookHandler.d.ts.map
|
|
8
|
+
//# sourceMappingURL=WebhookHandler.d.ts.map
|
|
@@ -11,9 +11,13 @@ export default class WebhookHandler extends Handler {
|
|
|
11
11
|
this.post(client.token);
|
|
12
12
|
}, 60000 * 30);
|
|
13
13
|
this.client.util.hasVoted = async (userId) => {
|
|
14
|
-
return !!(
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
return !!(
|
|
15
|
+
await (
|
|
16
|
+
await fetch(`https://top.gg/api/bots/${this.client.user?.id}/check?userId=${userId}`, {
|
|
17
|
+
headers: { Authorization: options.token, 'Content-Type': 'application/json' },
|
|
18
|
+
})
|
|
19
|
+
).json()
|
|
20
|
+
).voted;
|
|
17
21
|
};
|
|
18
22
|
});
|
|
19
23
|
}
|
|
@@ -38,11 +42,10 @@ export default class WebhookHandler extends Handler {
|
|
|
38
42
|
shard_count: this.client.stats.shardCount,
|
|
39
43
|
}),
|
|
40
44
|
});
|
|
41
|
-
}
|
|
42
|
-
catch (error) {
|
|
45
|
+
} catch (error) {
|
|
43
46
|
new XernerxLog(this.client).error(`An error occurred while posting stats to Top.gg`, error);
|
|
44
47
|
return this.client.emit('webhookError', this.client, this.client.stats);
|
|
45
48
|
}
|
|
46
49
|
}
|
|
47
50
|
}
|
|
48
|
-
//# sourceMappingURL=WebhookHandler.js.map
|
|
51
|
+
//# sourceMappingURL=WebhookHandler.js.map
|
package/dist/main.d.ts
CHANGED
|
@@ -15,25 +15,32 @@ export * from './types/interfaces.js';
|
|
|
15
15
|
import Discord from 'discord.js';
|
|
16
16
|
declare const version: any;
|
|
17
17
|
export default XernerxClient;
|
|
18
|
-
export {
|
|
19
|
-
/**
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
XernerxClient,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
18
|
+
export {
|
|
19
|
+
/**
|
|
20
|
+
** Clients
|
|
21
|
+
*/
|
|
22
|
+
XernerxClient,
|
|
23
|
+
XernerxShardClient,
|
|
24
|
+
/**
|
|
25
|
+
** Builders
|
|
26
|
+
*/
|
|
27
|
+
MessageCommandBuilder,
|
|
28
|
+
SlashCommandBuilder,
|
|
29
|
+
ContextCommandBuilder,
|
|
30
|
+
EventBuilder,
|
|
31
|
+
InhibitorBuilder,
|
|
32
|
+
ExtensionBuilder,
|
|
33
|
+
/**
|
|
34
|
+
** Imported exports
|
|
35
|
+
*/
|
|
36
|
+
Discord,
|
|
37
|
+
/**
|
|
38
|
+
** Properties
|
|
39
|
+
*/
|
|
40
|
+
version,
|
|
41
|
+
/**
|
|
42
|
+
** Tools
|
|
43
|
+
*/
|
|
44
|
+
XernerxLog,
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=main.d.ts.map
|
package/dist/main.js
CHANGED
|
@@ -16,25 +16,32 @@ export * from './types/interfaces.js';
|
|
|
16
16
|
import Discord from 'discord.js';
|
|
17
17
|
const version = JSON.parse(fs.readFileSync('node_modules/xernerx/package.json', 'utf-8')).version;
|
|
18
18
|
export default XernerxClient;
|
|
19
|
-
export {
|
|
20
|
-
/**
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
XernerxClient,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
19
|
+
export {
|
|
20
|
+
/**
|
|
21
|
+
** Clients
|
|
22
|
+
*/
|
|
23
|
+
XernerxClient,
|
|
24
|
+
XernerxShardClient,
|
|
25
|
+
/**
|
|
26
|
+
** Builders
|
|
27
|
+
*/
|
|
28
|
+
MessageCommandBuilder,
|
|
29
|
+
SlashCommandBuilder,
|
|
30
|
+
ContextCommandBuilder,
|
|
31
|
+
EventBuilder,
|
|
32
|
+
InhibitorBuilder,
|
|
33
|
+
ExtensionBuilder,
|
|
34
|
+
/**
|
|
35
|
+
** Imported exports
|
|
36
|
+
*/
|
|
37
|
+
Discord,
|
|
38
|
+
/**
|
|
39
|
+
** Properties
|
|
40
|
+
*/
|
|
41
|
+
version,
|
|
42
|
+
/**
|
|
43
|
+
** Tools
|
|
44
|
+
*/
|
|
45
|
+
XernerxLog,
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=main.js.map
|
|
@@ -6,4 +6,4 @@ import { MessageCommandArguments } from '../types/interfaces.js';
|
|
|
6
6
|
import { XernerxInteraction } from '../types/types.js';
|
|
7
7
|
export declare function messageArguments(message: XernerxMessage, command: MessageCommandBuilder): Promise<MessageCommandArguments>;
|
|
8
8
|
export declare function interactionArguments(interaction: XernerxInteraction | any, command: ContextCommandBuilder | SlashCommandBuilder): Promise<any>;
|
|
9
|
-
//# sourceMappingURL=Arguments.d.ts.map
|
|
9
|
+
//# sourceMappingURL=Arguments.d.ts.map
|