xernerx 3.5.1 → 3.5.2
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 → cjs/build}/ContextCommandBuilder.d.ts +36 -28
- package/dist/cjs/build/ContextCommandBuilder.js +97 -0
- package/dist/cjs/build/EventBuilder.js +44 -0
- package/dist/{build → cjs/build}/InhibitorBuilder.d.ts +1 -1
- package/dist/cjs/build/InhibitorBuilder.js +37 -0
- package/dist/{build → cjs/build}/MessageCommandBuilder.d.ts +23 -17
- package/dist/cjs/build/MessageCommandBuilder.js +100 -0
- package/dist/{build → cjs/build}/SlashCommandBuilder.d.ts +25 -18
- package/dist/cjs/build/SlashCommandBuilder.js +169 -0
- package/dist/cjs/client/XernerxClient.js +116 -0
- package/dist/{handlers → cjs/handlers}/CommandHandler.js +11 -8
- package/dist/{handlers → cjs/handlers}/EventHandler.js +6 -3
- package/dist/cjs/handlers/Handler.js +308 -0
- package/dist/{handlers → cjs/handlers}/InhibitorHandler.js +6 -3
- package/dist/{main.d.ts → cjs/main.d.ts} +15 -1
- package/dist/cjs/main.js +112 -0
- package/dist/{models → cjs/models}/CommandArguments.d.ts +1 -1
- package/dist/{models → cjs/models}/CommandArguments.js +37 -52
- package/dist/cjs/models/Events.js +307 -0
- package/dist/cjs/models/Extensions.js +26 -0
- package/dist/{tools → cjs/tools}/XernerxError.js +4 -1
- package/dist/{tools → cjs/tools}/package.js +8 -6
- package/dist/cjs/types/enums.d.ts +44 -0
- package/dist/cjs/types/enums.js +38 -0
- package/dist/cjs/types/interfaces.js +2 -0
- package/dist/cjs/types/options.js +2 -0
- package/dist/{types → cjs/types}/types.d.ts +36 -9
- package/dist/cjs/types/types.js +2 -0
- package/dist/{utils → cjs/utils}/ClientUtil.js +73 -84
- package/dist/{utils → cjs/utils}/CommandUtil.d.ts +4 -2
- package/dist/{utils → cjs/utils}/CommandUtil.js +102 -103
- package/dist/{validators → cjs/validators}/CommandValidations.d.ts +6 -1
- package/dist/{validators → cjs/validators}/CommandValidations.js +36 -50
- package/dist/{validators → cjs/validators}/InhibitorValidations.js +12 -14
- package/dist/mjs/build/ContextCommandBuilder.d.ts +68 -0
- package/dist/mjs/build/ContextCommandBuilder.js +97 -0
- package/dist/mjs/build/EventBuilder.d.ts +21 -0
- package/dist/mjs/build/EventBuilder.js +44 -0
- package/dist/mjs/build/InhibitorBuilder.d.ts +19 -0
- package/dist/mjs/build/InhibitorBuilder.js +37 -0
- package/dist/mjs/build/MessageCommandBuilder.d.ts +59 -0
- package/dist/mjs/build/MessageCommandBuilder.js +100 -0
- package/dist/mjs/build/SlashCommandBuilder.d.ts +65 -0
- package/dist/mjs/build/SlashCommandBuilder.js +169 -0
- package/dist/mjs/client/XernerxClient.d.ts +28 -0
- package/dist/mjs/client/XernerxClient.js +116 -0
- package/dist/mjs/handlers/CommandHandler.d.ts +27 -0
- package/dist/mjs/handlers/CommandHandler.js +45 -0
- package/dist/mjs/handlers/EventHandler.d.ts +13 -0
- package/dist/mjs/handlers/EventHandler.js +19 -0
- package/dist/mjs/handlers/Handler.d.ts +57 -0
- package/dist/mjs/handlers/Handler.js +308 -0
- package/dist/mjs/handlers/InhibitorHandler.d.ts +18 -0
- package/dist/mjs/handlers/InhibitorHandler.js +24 -0
- package/dist/{main.js → mjs/main.d.ts} +20 -18
- package/dist/mjs/main.js +112 -0
- package/dist/mjs/models/CommandArguments.d.ts +17 -0
- package/dist/mjs/models/CommandArguments.js +106 -0
- package/dist/mjs/models/Events.d.ts +24 -0
- package/dist/mjs/models/Events.js +307 -0
- package/dist/mjs/models/Extensions.d.ts +7 -0
- package/dist/mjs/models/Extensions.js +26 -0
- package/dist/mjs/tools/XernerxError.d.ts +5 -0
- package/dist/mjs/tools/XernerxError.js +11 -0
- package/dist/mjs/tools/package.d.ts +49 -0
- package/dist/mjs/tools/package.js +50 -0
- package/dist/mjs/types/enums.d.ts +44 -0
- package/dist/mjs/types/enums.js +38 -0
- package/dist/mjs/types/interfaces.d.ts +25 -0
- package/dist/mjs/types/interfaces.js +2 -0
- package/dist/mjs/types/options.d.ts +241 -0
- package/dist/mjs/types/options.js +2 -0
- package/dist/mjs/types/types.d.ts +61 -0
- package/dist/mjs/types/types.js +2 -0
- package/dist/mjs/utils/ClientUtil.d.ts +25 -0
- package/dist/mjs/utils/ClientUtil.js +211 -0
- package/dist/mjs/utils/CommandUtil.d.ts +58 -0
- package/dist/mjs/utils/CommandUtil.js +247 -0
- package/dist/mjs/validators/CommandValidations.d.ts +12 -0
- package/dist/mjs/validators/CommandValidations.js +169 -0
- package/dist/mjs/validators/InhibitorValidations.d.ts +11 -0
- package/dist/mjs/validators/InhibitorValidations.js +40 -0
- package/package.json +10 -15
- package/dist/build/ContextCommandBuilder.js +0 -93
- package/dist/build/EventBuilder.js +0 -34
- package/dist/build/InhibitorBuilder.js +0 -27
- package/dist/build/MessageCommandBuilder.js +0 -90
- package/dist/build/SlashCommandBuilder.js +0 -125
- package/dist/client/XernerxClient.js +0 -101
- package/dist/handlers/Handler.js +0 -250
- package/dist/main.cjs +0 -2023
- package/dist/models/Events.js +0 -294
- package/dist/models/Extensions.js +0 -23
- package/dist/types/enums.d.ts +0 -35
- package/dist/types/enums.js +0 -35
- package/dist/types/interfaces.js +0 -1
- package/dist/types/options.js +0 -1
- package/dist/types/types.js +0 -1
- package/dist/validators/Shapes.js +0 -1
- /package/dist/{build → cjs/build}/EventBuilder.d.ts +0 -0
- /package/dist/{client → cjs/client}/XernerxClient.d.ts +0 -0
- /package/dist/{handlers → cjs/handlers}/CommandHandler.d.ts +0 -0
- /package/dist/{handlers → cjs/handlers}/EventHandler.d.ts +0 -0
- /package/dist/{handlers → cjs/handlers}/Handler.d.ts +0 -0
- /package/dist/{handlers → cjs/handlers}/InhibitorHandler.d.ts +0 -0
- /package/dist/{models → cjs/models}/Events.d.ts +0 -0
- /package/dist/{models → cjs/models}/Extensions.d.ts +0 -0
- /package/dist/{tools → cjs/tools}/XernerxError.d.ts +0 -0
- /package/dist/{tools → cjs/tools}/package.d.ts +0 -0
- /package/dist/{types → cjs/types}/interfaces.d.ts +0 -0
- /package/dist/{types → cjs/types}/options.d.ts +0 -0
- /package/dist/{utils → cjs/utils}/ClientUtil.d.ts +0 -0
- /package/dist/{validators → cjs/validators}/InhibitorValidations.d.ts +0 -0
package/dist/models/Events.js
DELETED
|
@@ -1,294 +0,0 @@
|
|
|
1
|
-
import { GatewayVersion, InteractionType, REST, Routes } from 'discord.js';
|
|
2
|
-
import { InteractionCommandUtil, MessageCommandUtil } from '../utils/CommandUtil.js';
|
|
3
|
-
import { InteractionArguments, messageArguments } from './CommandArguments.js';
|
|
4
|
-
import commandValidation from '../validators/CommandValidations.js';
|
|
5
|
-
import { Style } from 'dumfunctions';
|
|
6
|
-
import { InhibitorValidation } from '../validators/InhibitorValidations.js';
|
|
7
|
-
export class MessageCommandEvents {
|
|
8
|
-
client;
|
|
9
|
-
constructor(client) {
|
|
10
|
-
this.client = client;
|
|
11
|
-
}
|
|
12
|
-
messageCreate() {
|
|
13
|
-
this.client.on('messageCreate', async (message) => {
|
|
14
|
-
if (!message.author.bot) {
|
|
15
|
-
let command = undefined, px = undefined;
|
|
16
|
-
message.author.isOwner = this.client.util.isOwner(message.author.id);
|
|
17
|
-
message.util = new MessageCommandUtil(this.client, message);
|
|
18
|
-
const commands = this.client.commands.message;
|
|
19
|
-
commands
|
|
20
|
-
.filter((c) => !c.regex)
|
|
21
|
-
.map(async (cmd) => {
|
|
22
|
-
if (cmd.prefix) {
|
|
23
|
-
cmd.prefix.map((prefix) => {
|
|
24
|
-
if (message.content.startsWith(prefix)) {
|
|
25
|
-
command = message.content.replace(prefix, '').split(/ +/).shift();
|
|
26
|
-
px = prefix;
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
if (this.client.handlerOptions.message?.prefix) {
|
|
31
|
-
const prefix = Array.isArray(this.client.handlerOptions.message.prefix) ? this.client.handlerOptions.message.prefix : [this.client.handlerOptions.message.prefix];
|
|
32
|
-
prefix.map((prefix) => {
|
|
33
|
-
if (message.content.startsWith(prefix)) {
|
|
34
|
-
command = message.content.replace(prefix, '').split(/ +/).shift();
|
|
35
|
-
px = prefix;
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
if (this.client.handlerOptions.message?.allowMention) {
|
|
40
|
-
if (message.mentions.users.has(this.client.user?.id) || message.mentions.repliedUser?.id === this.client.user?.id) {
|
|
41
|
-
command = message.content.replace(`<@${this.client.user?.id}>`, '').trim().split(/ +/).shift();
|
|
42
|
-
px = 'MentionPrefix';
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
const prefix = Array.isArray(this.client.handlerOptions.message?.prefix) ? this.client.handlerOptions.message?.prefix : [this.client.handlerOptions.message?.prefix];
|
|
46
|
-
if ((cmd.name.toLowerCase() == command?.toLowerCase() || cmd.aliases?.map((c) => c.toLowerCase())?.includes(command?.toLowerCase())) &&
|
|
47
|
-
(cmd.prefix.includes(px) || prefix?.includes(px) || px === 'MentionPrefix')) {
|
|
48
|
-
try {
|
|
49
|
-
if (this.client.handlerOptions.message?.handleTyping)
|
|
50
|
-
message.channel.sendTyping();
|
|
51
|
-
const inhibitor = new InhibitorValidation(this.client, message, command);
|
|
52
|
-
if (commandValidation(message, cmd, this.client))
|
|
53
|
-
return;
|
|
54
|
-
if (await inhibitor.inhibit())
|
|
55
|
-
return;
|
|
56
|
-
if (cmd.conditions && (await cmd.conditions(message, (await messageArguments(message, cmd)))))
|
|
57
|
-
return;
|
|
58
|
-
await cmd.exec(message, (await messageArguments(message, cmd)));
|
|
59
|
-
this.client.emit('commandRun', message, cmd);
|
|
60
|
-
}
|
|
61
|
-
catch (error) {
|
|
62
|
-
return this.client.emit('commandError', message, error, cmd);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
messageUpdate() {
|
|
70
|
-
this.client.on('messageUpdate', async (old, message) => {
|
|
71
|
-
message = message;
|
|
72
|
-
if (!message.author?.bot) {
|
|
73
|
-
let command = undefined, px = undefined;
|
|
74
|
-
if (message.author)
|
|
75
|
-
message.author.isOwner = this.client.util.isOwner(message.author.id);
|
|
76
|
-
message.util = new MessageCommandUtil(this.client, message);
|
|
77
|
-
const commands = this.client.commands.message;
|
|
78
|
-
commands
|
|
79
|
-
.filter((c) => !c.regex)
|
|
80
|
-
.map(async (cmd) => {
|
|
81
|
-
if (cmd.prefix) {
|
|
82
|
-
cmd.prefix.map((prefix) => {
|
|
83
|
-
if (message?.content?.startsWith(prefix)) {
|
|
84
|
-
command = message.content.replace(prefix, '').split(/ +/).shift();
|
|
85
|
-
px = prefix;
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
if (this.client.handlerOptions.message?.prefix) {
|
|
90
|
-
const prefix = Array.isArray(this.client.handlerOptions.message.prefix) ? this.client.handlerOptions.message.prefix : [this.client.handlerOptions.message.prefix];
|
|
91
|
-
prefix.map((prefix) => {
|
|
92
|
-
if (message?.content?.startsWith(prefix)) {
|
|
93
|
-
command = message.content.replace(prefix, '').split(/ +/).shift();
|
|
94
|
-
px = prefix;
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
if (this.client.handlerOptions.message?.allowMention) {
|
|
99
|
-
if (message.mentions.users.has(this.client.user?.id || '') || message.mentions.repliedUser?.id === this.client.user?.id) {
|
|
100
|
-
command = message?.content?.replace(`<@${this.client.user?.id}>`, '').trim().split(/ +/).shift();
|
|
101
|
-
px = 'MentionPrefix';
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
const prefix = Array.isArray(this.client.handlerOptions.message?.prefix) ? this.client.handlerOptions.message?.prefix : [this.client.handlerOptions.message?.prefix];
|
|
105
|
-
if ((cmd.name.toLowerCase() == command?.toLowerCase() || cmd.aliases?.map((c) => c.toLowerCase())?.includes(command?.toLowerCase())) &&
|
|
106
|
-
(cmd.prefix.includes(px) || prefix?.includes(px) || px === 'MentionPrefix')) {
|
|
107
|
-
try {
|
|
108
|
-
if (this.client.handlerOptions.message?.handleTyping)
|
|
109
|
-
message.channel.sendTyping();
|
|
110
|
-
message = message;
|
|
111
|
-
const inhibitor = new InhibitorValidation(this.client, message, command);
|
|
112
|
-
if (commandValidation(message, cmd, this.client))
|
|
113
|
-
return;
|
|
114
|
-
if (await inhibitor.inhibit())
|
|
115
|
-
return;
|
|
116
|
-
if (cmd.conditions && (await cmd.conditions(message, (await messageArguments(message, cmd)))))
|
|
117
|
-
return;
|
|
118
|
-
await cmd.exec(message, (await messageArguments(message, cmd)));
|
|
119
|
-
this.client.emit('commandRun', message, cmd);
|
|
120
|
-
}
|
|
121
|
-
catch (error) {
|
|
122
|
-
return this.client.emit('commandError', message, error, cmd);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
messageDelete() {
|
|
130
|
-
this.client.on('messageDelete', async (message) => {
|
|
131
|
-
if (this.client.cache.messages.has(message.id) && this.client.handlerOptions.message?.handleDeletes) {
|
|
132
|
-
try {
|
|
133
|
-
if (this.client.handlerOptions.message?.handleTyping)
|
|
134
|
-
message.channel.sendTyping();
|
|
135
|
-
const msg = this.client.cache.messages.get(message.id);
|
|
136
|
-
const response = await message.channel.messages.fetch(msg?.response);
|
|
137
|
-
await response.delete();
|
|
138
|
-
}
|
|
139
|
-
catch (error) {
|
|
140
|
-
this.client.emit('commandError', message, error, null);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
export class SlashCommandEvents {
|
|
147
|
-
client;
|
|
148
|
-
constructor(client) {
|
|
149
|
-
this.client = client;
|
|
150
|
-
}
|
|
151
|
-
slashCreate() {
|
|
152
|
-
this.client.on('interactionCreate', async (interaction) => {
|
|
153
|
-
interaction.util = new InteractionCommandUtil(this.client, interaction);
|
|
154
|
-
interaction.user.isOwner = this.client.util.isOwner(interaction.user.id);
|
|
155
|
-
if (interaction.type === InteractionType.ApplicationCommand) {
|
|
156
|
-
if (this.client.commands.slash.has(interaction.commandName)) {
|
|
157
|
-
let command = this.client.commands.slash.get(interaction.commandName);
|
|
158
|
-
const argumentsInfo = new InteractionArguments(interaction);
|
|
159
|
-
try {
|
|
160
|
-
const inhibitor = new InhibitorValidation(this.client, interaction, command);
|
|
161
|
-
if (await inhibitor.inhibit())
|
|
162
|
-
return;
|
|
163
|
-
if (commandValidation(interaction, command, this.client))
|
|
164
|
-
return;
|
|
165
|
-
if (command.defer?.reply !== false && this.client.handlerOptions.slash?.defer?.reply)
|
|
166
|
-
await interaction.deferReply({
|
|
167
|
-
ephemeral: this.client.handlerOptions.slash?.defer?.ephemeral,
|
|
168
|
-
fetchReply: this.client.handlerOptions.slash?.defer?.fetchReply,
|
|
169
|
-
});
|
|
170
|
-
if (!(interaction.deferred || interaction.replied) && command.defer?.reply)
|
|
171
|
-
await interaction.deferReply({
|
|
172
|
-
ephemeral: command.defer?.ephemeral,
|
|
173
|
-
fetchReply: command.defer?.fetchReply,
|
|
174
|
-
});
|
|
175
|
-
if (command.conditions &&
|
|
176
|
-
(await command.conditions(interaction, {
|
|
177
|
-
group: argumentsInfo.group(),
|
|
178
|
-
subcommand: argumentsInfo.subcommand(),
|
|
179
|
-
args: await argumentsInfo.arguments(),
|
|
180
|
-
})))
|
|
181
|
-
return;
|
|
182
|
-
await command.exec(interaction, {
|
|
183
|
-
group: argumentsInfo.group(),
|
|
184
|
-
subcommand: argumentsInfo.subcommand(),
|
|
185
|
-
args: await argumentsInfo.arguments(),
|
|
186
|
-
});
|
|
187
|
-
this.client.emit('commandRun', interaction, command);
|
|
188
|
-
}
|
|
189
|
-
catch (error) {
|
|
190
|
-
this.client.emit('commandError', interaction, error, command);
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
});
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
export class ContextCommandEvents {
|
|
198
|
-
client;
|
|
199
|
-
constructor(client) {
|
|
200
|
-
this.client = client;
|
|
201
|
-
}
|
|
202
|
-
contextCreate() {
|
|
203
|
-
this.client.on('interactionCreate', async (interaction) => {
|
|
204
|
-
interaction.util = new InteractionCommandUtil(this.client, interaction);
|
|
205
|
-
interaction.user.isOwner = this.client.util.isOwner(interaction.user.id);
|
|
206
|
-
if (interaction.type === InteractionType.ApplicationCommand) {
|
|
207
|
-
if (this.client.commands.context.has(interaction.commandName)) {
|
|
208
|
-
let command = this.client.commands.context.get(interaction.commandName);
|
|
209
|
-
try {
|
|
210
|
-
const inhibitor = new InhibitorValidation(this.client, interaction, command);
|
|
211
|
-
if (commandValidation(interaction, command, this.client))
|
|
212
|
-
return;
|
|
213
|
-
if (await inhibitor.inhibit())
|
|
214
|
-
return;
|
|
215
|
-
if (command.conditions && (await command.conditions(interaction)))
|
|
216
|
-
return;
|
|
217
|
-
if (command.defer?.reply !== false && this.client.handlerOptions.context?.defer?.reply)
|
|
218
|
-
await interaction.deferReply({
|
|
219
|
-
ephemeral: this.client.handlerOptions.context?.defer?.ephemeral,
|
|
220
|
-
fetchReply: this.client.handlerOptions.context?.defer?.fetchReply,
|
|
221
|
-
});
|
|
222
|
-
if (!(interaction.deferred || interaction.replied) && command.defer?.reply)
|
|
223
|
-
await interaction.deferReply({
|
|
224
|
-
ephemeral: command.defer?.ephemeral,
|
|
225
|
-
fetchReply: command.defer?.fetchReply,
|
|
226
|
-
});
|
|
227
|
-
let args = {};
|
|
228
|
-
if (command.type === 3)
|
|
229
|
-
args = await interaction.channel.messages.fetch(interaction.targetId);
|
|
230
|
-
if (command.type === 2)
|
|
231
|
-
args = await this.client.users.fetch(interaction.targetId);
|
|
232
|
-
await command.exec(interaction, args);
|
|
233
|
-
this.client.emit('commandRun', interaction, command);
|
|
234
|
-
}
|
|
235
|
-
catch (error) {
|
|
236
|
-
this.client.emit('commandError', interaction, error, command);
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
});
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
export class CommandsDeploy {
|
|
244
|
-
client;
|
|
245
|
-
constructor(client) {
|
|
246
|
-
this.client = client;
|
|
247
|
-
}
|
|
248
|
-
deploy() {
|
|
249
|
-
this.client.once('ready', async (client) => {
|
|
250
|
-
const slashCommands = [], contextCommands = [];
|
|
251
|
-
this.client.commands.context.map((command) => (command.data ? contextCommands.push(command.data.toJSON()) : null));
|
|
252
|
-
this.client.commands.slash.map((command) => (command.data ? slashCommands.push(command.data.toJSON()) : null));
|
|
253
|
-
try {
|
|
254
|
-
const global = {
|
|
255
|
-
slash: this.client.handlerOptions.slash?.global,
|
|
256
|
-
context: this.client.handlerOptions.context?.global,
|
|
257
|
-
};
|
|
258
|
-
const guild = {
|
|
259
|
-
slash: this.client.handlerOptions.slash?.guildId,
|
|
260
|
-
context: this.client.handlerOptions.context?.guildId,
|
|
261
|
-
};
|
|
262
|
-
if (global.slash && global.context) {
|
|
263
|
-
if (guild.slash !== guild.context)
|
|
264
|
-
console.info(Style.log(`Xernerx | Warning: slash and context commands are both set to global, but don't have a matching guildId, using ${(await this.client.guilds.fetch(this.client.handlerOptions.slash?.guildId)).name}!`, { color: Style.TextColor.Red }));
|
|
265
|
-
this.put('global', guild.slash, [...contextCommands, ...slashCommands]);
|
|
266
|
-
this.put('guild', guild.slash, []);
|
|
267
|
-
}
|
|
268
|
-
if (global.slash && global.context === false) {
|
|
269
|
-
this.put('global', guild.slash, slashCommands);
|
|
270
|
-
}
|
|
271
|
-
if (global.slash === false && global.context) {
|
|
272
|
-
this.put('global', guild.context, contextCommands);
|
|
273
|
-
}
|
|
274
|
-
if (global.slash === false && global.context === false) {
|
|
275
|
-
this.put('guild', guild.slash, [...contextCommands, ...slashCommands]);
|
|
276
|
-
}
|
|
277
|
-
if (this.client.handlerOptions.context?.logging || this.client.handlerOptions.slash?.logging)
|
|
278
|
-
console.info(Style.log(`Xernerx | Deployed ${slashCommands.length} slash commands ${global.slash ? 'globally' : 'locally'} and ${contextCommands.length} context commands ${global.context ? 'globally' : 'locally'}.`, { color: Style.TextColor.Purple }));
|
|
279
|
-
}
|
|
280
|
-
catch (error) {
|
|
281
|
-
console.error(Style.log(`Xernerx | Couldn't deploy interaction commands because <${error}>.`, {
|
|
282
|
-
color: Style.BackgroundColor.Red,
|
|
283
|
-
}));
|
|
284
|
-
}
|
|
285
|
-
});
|
|
286
|
-
}
|
|
287
|
-
put(type, guild, body) {
|
|
288
|
-
const rest = new REST({ version: GatewayVersion }).setToken(this.client.token);
|
|
289
|
-
if (type === 'guild')
|
|
290
|
-
rest.put(Routes.applicationGuildCommands(this.client.user?.id, guild), { body });
|
|
291
|
-
else
|
|
292
|
-
rest.put(Routes.applicationCommands(this.client.user?.id), { body });
|
|
293
|
-
}
|
|
294
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { Style } from 'dumfunctions';
|
|
2
|
-
export default class Extensions {
|
|
3
|
-
client;
|
|
4
|
-
constructor(client) {
|
|
5
|
-
this.client = client;
|
|
6
|
-
}
|
|
7
|
-
async load(extensions, logging = false) {
|
|
8
|
-
const exts = [];
|
|
9
|
-
extensions.map((extension) => {
|
|
10
|
-
try {
|
|
11
|
-
this.client.extensions[extension.name] = extension;
|
|
12
|
-
exts.push(extension.name);
|
|
13
|
-
}
|
|
14
|
-
catch (error) {
|
|
15
|
-
console.error(Style.log(`Xernerx | An error occurred trying to load ${extension.name}, error: <${error}>`, {
|
|
16
|
-
color: Style.BackgroundColor.Red,
|
|
17
|
-
}));
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
if (logging)
|
|
21
|
-
console.info(Style.log(`Xernerx | Loaded ${exts.length} extensions: ${exts.join(', ')}`, { color: Style.TextColor.Cyan }));
|
|
22
|
-
}
|
|
23
|
-
}
|
package/dist/types/enums.d.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { SlashCommandStringOption, SlashCommandNumberOption, SlashCommandIntegerOption, SlashCommandBooleanOption, SlashCommandUserOption, SlashCommandChannelOption, SlashCommandRoleOption, SlashCommandMentionableOption } from 'discord.js';
|
|
2
|
-
export declare enum InhibitorType {
|
|
3
|
-
Member = "Member",
|
|
4
|
-
User = "User",
|
|
5
|
-
Guild = "Guild",
|
|
6
|
-
SlashCommand = "SlashCommand",
|
|
7
|
-
MessageCommand = "MessageCommand",
|
|
8
|
-
ContextCommand = "ContextCommand",
|
|
9
|
-
Command = "Command",
|
|
10
|
-
Message = "Message",
|
|
11
|
-
Interaction = "Interaction",
|
|
12
|
-
Channel = "Channel"
|
|
13
|
-
}
|
|
14
|
-
export declare enum CommandType {
|
|
15
|
-
Message = "MessageCommand",
|
|
16
|
-
Slash = "SlashCommand",
|
|
17
|
-
Context = "ContextCommand",
|
|
18
|
-
Event = "Event",
|
|
19
|
-
Inhibitor = "Inhibitor",
|
|
20
|
-
MessageCommand = "MessageCommand",
|
|
21
|
-
SlashCommand = "SlashCommand",
|
|
22
|
-
ContextCommand = "ContextCommand"
|
|
23
|
-
}
|
|
24
|
-
export declare enum ContextCommandType {
|
|
25
|
-
Message = 3,
|
|
26
|
-
User = 2
|
|
27
|
-
}
|
|
28
|
-
export declare enum EventEmitterType {
|
|
29
|
-
Client = "client",
|
|
30
|
-
Rest = "rest",
|
|
31
|
-
Process = "process"
|
|
32
|
-
}
|
|
33
|
-
export type SlashCommandOptionChoices = SlashCommandStringOption | SlashCommandNumberOption | SlashCommandIntegerOption;
|
|
34
|
-
export type SlashCommandOption = SlashCommandOptionChoices | SlashCommandBooleanOption | SlashCommandUserOption | SlashCommandChannelOption | SlashCommandRoleOption | SlashCommandMentionableOption;
|
|
35
|
-
export type SlashArgumentTypes = 'String' | 'Number' | 'Boolean' | 'User' | 'Channel' | 'Role' | 'Mentionable' | 'Integer';
|
package/dist/types/enums.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
export var InhibitorType;
|
|
2
|
-
(function (InhibitorType) {
|
|
3
|
-
InhibitorType["Member"] = "Member";
|
|
4
|
-
InhibitorType["User"] = "User";
|
|
5
|
-
InhibitorType["Guild"] = "Guild";
|
|
6
|
-
InhibitorType["SlashCommand"] = "SlashCommand";
|
|
7
|
-
InhibitorType["MessageCommand"] = "MessageCommand";
|
|
8
|
-
InhibitorType["ContextCommand"] = "ContextCommand";
|
|
9
|
-
InhibitorType["Command"] = "Command";
|
|
10
|
-
InhibitorType["Message"] = "Message";
|
|
11
|
-
InhibitorType["Interaction"] = "Interaction";
|
|
12
|
-
InhibitorType["Channel"] = "Channel";
|
|
13
|
-
})(InhibitorType = InhibitorType || (InhibitorType = {}));
|
|
14
|
-
export var CommandType;
|
|
15
|
-
(function (CommandType) {
|
|
16
|
-
CommandType["Message"] = "MessageCommand";
|
|
17
|
-
CommandType["Slash"] = "SlashCommand";
|
|
18
|
-
CommandType["Context"] = "ContextCommand";
|
|
19
|
-
CommandType["Event"] = "Event";
|
|
20
|
-
CommandType["Inhibitor"] = "Inhibitor";
|
|
21
|
-
CommandType["MessageCommand"] = "MessageCommand";
|
|
22
|
-
CommandType["SlashCommand"] = "SlashCommand";
|
|
23
|
-
CommandType["ContextCommand"] = "ContextCommand";
|
|
24
|
-
})(CommandType = CommandType || (CommandType = {}));
|
|
25
|
-
export var ContextCommandType;
|
|
26
|
-
(function (ContextCommandType) {
|
|
27
|
-
ContextCommandType[ContextCommandType["Message"] = 3] = "Message";
|
|
28
|
-
ContextCommandType[ContextCommandType["User"] = 2] = "User";
|
|
29
|
-
})(ContextCommandType = ContextCommandType || (ContextCommandType = {}));
|
|
30
|
-
export var EventEmitterType;
|
|
31
|
-
(function (EventEmitterType) {
|
|
32
|
-
EventEmitterType["Client"] = "client";
|
|
33
|
-
EventEmitterType["Rest"] = "rest";
|
|
34
|
-
EventEmitterType["Process"] = "process";
|
|
35
|
-
})(EventEmitterType = EventEmitterType || (EventEmitterType = {}));
|
package/dist/types/interfaces.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/types/options.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/types/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|