xernerx 3.5.2 → 4.0.0
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 +47 -0
- package/dist/build/ContextCommandBuilder.js +78 -0
- package/dist/{cjs/build → build}/EventBuilder.d.ts +7 -6
- package/dist/build/EventBuilder.js +35 -0
- package/dist/build/InhibitorBuilder.d.ts +17 -0
- package/dist/build/InhibitorBuilder.js +26 -0
- package/dist/build/MessageCommandBuilder.d.ts +43 -0
- package/dist/build/MessageCommandBuilder.js +71 -0
- package/dist/{cjs/build → build}/SlashCommandBuilder.d.ts +16 -31
- package/dist/build/SlashCommandBuilder.js +122 -0
- package/dist/build copy/ContextCommandBuilder.d.ts +37 -0
- package/dist/build copy/ContextCommandBuilder.js +88 -0
- package/dist/{mjs/build/EventBuilder.d.ts → build copy/EventBuilder.d.ts } +4 -4
- package/dist/build copy/EventBuilder.js +34 -0
- package/dist/{cjs/build/InhibitorBuilder.d.ts → build copy/InhibitorBuilder.d.ts } +2 -2
- package/dist/build copy/InhibitorBuilder.js +27 -0
- package/dist/{cjs/build/MessageCommandBuilder.d.ts → build copy/MessageCommandBuilder.d.ts } +14 -34
- package/dist/build copy/MessageCommandBuilder.js +90 -0
- package/dist/build copy/SlashCommandBuilder.d.ts +41 -0
- package/dist/build copy/SlashCommandBuilder.js +122 -0
- package/dist/client/DBLClient.d.ts +8 -0
- package/dist/client/DBLClient.js +15 -0
- package/dist/client/Top.ggClient.d.ts +1 -0
- package/dist/client/Top.ggClient.js +1 -0
- package/dist/client/XernerxClient.d.ts +54 -0
- package/dist/client/XernerxClient.js +90 -0
- package/dist/events/messageCreate.d.ts +1 -0
- package/dist/events/messageCreate.js +1 -0
- package/dist/functions/AsyncFunctions.d.ts +1 -0
- package/dist/functions/AsyncFunctions.js +1 -0
- package/dist/functions/delay.d.ts +1 -0
- package/dist/functions/delay.js +3 -0
- package/dist/functions/deploy.d.ts +2 -0
- package/dist/functions/deploy.js +29 -0
- package/dist/functions/getPermissionBitField.d.ts +2 -0
- package/dist/functions/getPermissionBitField.js +17 -0
- package/dist/functions/hasVoted.d.ts +1 -0
- package/dist/functions/hasVoted.js +1 -0
- package/dist/functions/isOwner.d.ts +3 -0
- package/dist/functions/isOwner.js +3 -0
- package/dist/functions/isVoter.d.ts +3 -0
- package/dist/functions/isVoter.js +5 -0
- package/dist/functions/load.d.ts +3 -0
- package/dist/functions/load.js +32 -0
- package/dist/functions/reload.d.ts +2 -0
- package/dist/functions/reload.js +39 -0
- package/dist/functions/sendWebhook.d.ts +2 -0
- package/dist/functions/sendWebhook.js +12 -0
- package/dist/functions/voted.d.ts +1 -0
- package/dist/functions/voted.js +1 -0
- package/dist/functions/xernerxUser.d.ts +3 -0
- package/dist/functions/xernerxUser.js +8 -0
- package/dist/handlers/CommandHandler.d.ts +13 -0
- package/dist/handlers/CommandHandler.js +220 -0
- package/dist/handlers/EventHandler.d.ts +7 -0
- package/dist/handlers/EventHandler.js +24 -0
- package/dist/handlers/ExtensionHandler.d.ts +7 -0
- package/dist/handlers/ExtensionHandler.js +19 -0
- package/dist/handlers/Handler.d.ts +14 -0
- package/dist/handlers/Handler.js +36 -0
- package/dist/handlers/InhibitorHandler.d.ts +7 -0
- package/dist/handlers/InhibitorHandler.js +24 -0
- package/dist/handlers/WebhookHandler.d.ts +7 -0
- package/dist/handlers/WebhookHandler.js +50 -0
- package/dist/main.d.ts +11 -0
- package/dist/main.js +11 -0
- package/dist/models/Arguments.d.ts +15 -0
- package/dist/models/Arguments.js +129 -0
- package/dist/{mjs/models → models}/CommandArguments.js +2 -7
- package/dist/{mjs/models → models}/Events.js +44 -54
- package/dist/models/Extensions.js +23 -0
- package/dist/models/XernerxUser.d.ts +2 -0
- package/dist/models/XernerxUser.js +9 -0
- package/dist/tools/XernerxError.d.ts +6 -0
- package/dist/tools/XernerxError.js +10 -0
- package/dist/tools/XernerxLog.d.ts +13 -0
- package/dist/tools/XernerxLog.js +30 -0
- package/dist/tools/classes.d.ts +6 -0
- package/dist/tools/classes.js +10 -0
- package/dist/tools/loggers.d.ts +4 -0
- package/dist/tools/loggers.js +4 -0
- package/dist/{cjs/tools → tools}/package.d.ts +5 -9
- package/dist/{cjs/tools → tools}/package.js +12 -18
- package/dist/{cjs/types → types}/enums.js +8 -11
- package/dist/types/extenders.d.ts +23 -0
- package/dist/types/extenders.js +1 -0
- package/dist/types/interfaces.d.ts +224 -0
- package/dist/types/interfaces.js +1 -0
- package/dist/{cjs/types → types}/options.d.ts +13 -0
- package/dist/types/options.js +1 -0
- package/dist/types/types.d.ts +181 -0
- package/dist/types/types.js +1 -0
- package/dist/utils/ClientUtil.d.ts +6 -0
- package/dist/utils/ClientUtil.js +7 -0
- package/dist/{cjs/utils → utils}/CommandUtil.js +14 -29
- package/dist/utils/InteractionArguments.d.ts +1 -0
- package/dist/utils/InteractionArguments.js +1 -0
- package/dist/utils/InteractionUtil.d.ts +10 -0
- package/dist/utils/InteractionUtil.js +15 -0
- package/dist/utils/MessageUtil.d.ts +11 -0
- package/dist/utils/MessageUtil.js +42 -0
- package/dist/utils/Util.d.ts +5 -0
- package/dist/utils/Util.js +6 -0
- package/dist/{mjs/validators → validators}/CommandValidations.js +11 -14
- package/dist/validators/InhibitorValidations.d.ts +18 -0
- package/dist/validators/InhibitorValidations.js +34 -0
- package/dist/validators/commandValidation.d.ts +6 -0
- package/dist/validators/commandValidation.js +48 -0
- package/dist/validators/commands.d.ts +4 -0
- package/dist/validators/commands.js +25 -0
- package/package.json +10 -13
- package/dist/cjs/build/ContextCommandBuilder.d.ts +0 -68
- package/dist/cjs/build/ContextCommandBuilder.js +0 -97
- package/dist/cjs/build/EventBuilder.js +0 -44
- package/dist/cjs/build/InhibitorBuilder.js +0 -37
- package/dist/cjs/build/MessageCommandBuilder.js +0 -100
- package/dist/cjs/build/SlashCommandBuilder.js +0 -169
- package/dist/cjs/client/XernerxClient.d.ts +0 -28
- package/dist/cjs/client/XernerxClient.js +0 -116
- package/dist/cjs/handlers/CommandHandler.d.ts +0 -27
- package/dist/cjs/handlers/CommandHandler.js +0 -45
- package/dist/cjs/handlers/EventHandler.d.ts +0 -13
- package/dist/cjs/handlers/EventHandler.js +0 -19
- package/dist/cjs/handlers/Handler.d.ts +0 -57
- package/dist/cjs/handlers/Handler.js +0 -308
- package/dist/cjs/handlers/InhibitorHandler.d.ts +0 -18
- package/dist/cjs/handlers/InhibitorHandler.js +0 -24
- package/dist/cjs/main.d.ts +0 -44
- package/dist/cjs/main.js +0 -112
- package/dist/cjs/models/CommandArguments.js +0 -106
- package/dist/cjs/models/Events.js +0 -307
- package/dist/cjs/models/Extensions.js +0 -26
- package/dist/cjs/tools/XernerxError.d.ts +0 -5
- package/dist/cjs/tools/XernerxError.js +0 -11
- package/dist/cjs/types/interfaces.d.ts +0 -25
- package/dist/cjs/types/interfaces.js +0 -2
- package/dist/cjs/types/options.js +0 -2
- package/dist/cjs/types/types.d.ts +0 -61
- package/dist/cjs/types/types.js +0 -2
- package/dist/cjs/utils/ClientUtil.d.ts +0 -25
- package/dist/cjs/utils/ClientUtil.js +0 -211
- package/dist/cjs/validators/CommandValidations.js +0 -169
- package/dist/cjs/validators/InhibitorValidations.d.ts +0 -11
- package/dist/cjs/validators/InhibitorValidations.js +0 -40
- package/dist/mjs/build/ContextCommandBuilder.d.ts +0 -68
- package/dist/mjs/build/ContextCommandBuilder.js +0 -97
- package/dist/mjs/build/EventBuilder.js +0 -44
- package/dist/mjs/build/InhibitorBuilder.d.ts +0 -19
- package/dist/mjs/build/InhibitorBuilder.js +0 -37
- package/dist/mjs/build/MessageCommandBuilder.d.ts +0 -59
- package/dist/mjs/build/MessageCommandBuilder.js +0 -100
- package/dist/mjs/build/SlashCommandBuilder.d.ts +0 -65
- package/dist/mjs/build/SlashCommandBuilder.js +0 -169
- package/dist/mjs/client/XernerxClient.d.ts +0 -28
- package/dist/mjs/client/XernerxClient.js +0 -116
- package/dist/mjs/handlers/CommandHandler.d.ts +0 -27
- package/dist/mjs/handlers/CommandHandler.js +0 -45
- package/dist/mjs/handlers/EventHandler.d.ts +0 -13
- package/dist/mjs/handlers/EventHandler.js +0 -19
- package/dist/mjs/handlers/Handler.d.ts +0 -57
- package/dist/mjs/handlers/Handler.js +0 -308
- package/dist/mjs/handlers/InhibitorHandler.d.ts +0 -18
- package/dist/mjs/handlers/InhibitorHandler.js +0 -24
- package/dist/mjs/main.d.ts +0 -44
- package/dist/mjs/main.js +0 -112
- package/dist/mjs/models/CommandArguments.d.ts +0 -17
- package/dist/mjs/models/Events.d.ts +0 -24
- package/dist/mjs/models/Extensions.d.ts +0 -7
- package/dist/mjs/models/Extensions.js +0 -26
- package/dist/mjs/tools/XernerxError.d.ts +0 -5
- package/dist/mjs/tools/XernerxError.js +0 -11
- package/dist/mjs/tools/package.d.ts +0 -49
- package/dist/mjs/tools/package.js +0 -50
- package/dist/mjs/types/enums.d.ts +0 -44
- package/dist/mjs/types/enums.js +0 -38
- package/dist/mjs/types/interfaces.d.ts +0 -25
- package/dist/mjs/types/interfaces.js +0 -2
- package/dist/mjs/types/options.d.ts +0 -241
- package/dist/mjs/types/options.js +0 -2
- package/dist/mjs/types/types.d.ts +0 -61
- package/dist/mjs/types/types.js +0 -2
- package/dist/mjs/utils/ClientUtil.d.ts +0 -25
- package/dist/mjs/utils/ClientUtil.js +0 -211
- package/dist/mjs/utils/CommandUtil.d.ts +0 -58
- package/dist/mjs/utils/CommandUtil.js +0 -247
- package/dist/mjs/validators/CommandValidations.d.ts +0 -12
- package/dist/mjs/validators/InhibitorValidations.d.ts +0 -11
- package/dist/mjs/validators/InhibitorValidations.js +0 -40
- /package/dist/{cjs/models → models}/CommandArguments.d.ts +0 -0
- /package/dist/{cjs/models → models}/Events.d.ts +0 -0
- /package/dist/{cjs/models → models}/Extensions.d.ts +0 -0
- /package/dist/{cjs/types → types}/enums.d.ts +0 -0
- /package/dist/{cjs/utils → utils}/CommandUtil.d.ts +0 -0
- /package/dist/{cjs/validators → validators}/CommandValidations.d.ts +0 -0
|
@@ -1,307 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
var __importDefault =
|
|
3
|
-
(this && this.__importDefault) ||
|
|
4
|
-
function (mod) {
|
|
5
|
-
return mod && mod.__esModule ? mod : { default: mod };
|
|
6
|
-
};
|
|
7
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
8
|
-
exports.CommandsDeploy = exports.ContextCommandEvents = exports.SlashCommandEvents = exports.MessageCommandEvents = void 0;
|
|
9
|
-
const discord_js_1 = require('discord.js');
|
|
10
|
-
const CommandUtil_js_1 = require('../utils/CommandUtil.js');
|
|
11
|
-
const CommandArguments_js_1 = require('./CommandArguments.js');
|
|
12
|
-
const CommandValidations_js_1 = __importDefault(require('../validators/CommandValidations.js'));
|
|
13
|
-
const dumfunctions_1 = require('dumfunctions');
|
|
14
|
-
const InhibitorValidations_js_1 = require('../validators/InhibitorValidations.js');
|
|
15
|
-
class MessageCommandEvents {
|
|
16
|
-
client;
|
|
17
|
-
constructor(client) {
|
|
18
|
-
this.client = client;
|
|
19
|
-
}
|
|
20
|
-
messageCreate() {
|
|
21
|
-
this.client.on('messageCreate', async (message) => {
|
|
22
|
-
if (!message.author.bot) {
|
|
23
|
-
let command = undefined,
|
|
24
|
-
px = undefined;
|
|
25
|
-
message.author.isOwner = this.client.util.isOwner(message.author.id);
|
|
26
|
-
message.util = new CommandUtil_js_1.MessageCommandUtil(this.client, message);
|
|
27
|
-
const commands = this.client.commands.message;
|
|
28
|
-
commands
|
|
29
|
-
.filter((c) => !c.regex)
|
|
30
|
-
.map(async (cmd) => {
|
|
31
|
-
if (cmd.prefix) {
|
|
32
|
-
cmd.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?.prefix) {
|
|
40
|
-
const prefix = Array.isArray(this.client.handlerOptions.message.prefix) ? this.client.handlerOptions.message.prefix : [this.client.handlerOptions.message.prefix];
|
|
41
|
-
prefix.map((prefix) => {
|
|
42
|
-
if (message.content.startsWith(prefix)) {
|
|
43
|
-
command = message.content.replace(prefix, '').split(/ +/).shift();
|
|
44
|
-
px = prefix;
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
if (this.client.handlerOptions.message?.allowMention) {
|
|
49
|
-
if (message.mentions.users.has(this.client.user?.id) || message.mentions.repliedUser?.id === this.client.user?.id) {
|
|
50
|
-
command = message.content.replace(`<@${this.client.user?.id}>`, '').trim().split(/ +/).shift();
|
|
51
|
-
px = 'MentionPrefix';
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
const prefix = Array.isArray(this.client.handlerOptions.message?.prefix) ? this.client.handlerOptions.message?.prefix : [this.client.handlerOptions.message?.prefix];
|
|
55
|
-
if (
|
|
56
|
-
(cmd.name.toLowerCase() == command?.toLowerCase() || cmd.aliases?.map((c) => c.toLowerCase())?.includes(command?.toLowerCase())) &&
|
|
57
|
-
(cmd.prefix.includes(px) || prefix?.includes(px) || px === 'MentionPrefix')
|
|
58
|
-
) {
|
|
59
|
-
try {
|
|
60
|
-
if (this.client.handlerOptions.message?.handleTyping) message.channel.sendTyping();
|
|
61
|
-
const inhibitor = new InhibitorValidations_js_1.InhibitorValidation(this.client, message, command);
|
|
62
|
-
if ((0, CommandValidations_js_1.default)(message, cmd, this.client)) return;
|
|
63
|
-
if (await inhibitor.inhibit()) return;
|
|
64
|
-
if (cmd.conditions && (await cmd.conditions(message, await (0, CommandArguments_js_1.messageArguments)(message, cmd)))) return;
|
|
65
|
-
await cmd.exec(message, await (0, CommandArguments_js_1.messageArguments)(message, cmd));
|
|
66
|
-
this.client.emit('commandRun', message, cmd);
|
|
67
|
-
} catch (error) {
|
|
68
|
-
return this.client.emit('commandError', message, error, cmd);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
messageUpdate() {
|
|
76
|
-
this.client.on('messageUpdate', async (old, message) => {
|
|
77
|
-
message = message;
|
|
78
|
-
if (!message.author?.bot) {
|
|
79
|
-
let command = undefined,
|
|
80
|
-
px = undefined;
|
|
81
|
-
if (message.author) message.author.isOwner = this.client.util.isOwner(message.author.id);
|
|
82
|
-
message.util = new CommandUtil_js_1.MessageCommandUtil(this.client, message);
|
|
83
|
-
const commands = this.client.commands.message;
|
|
84
|
-
commands
|
|
85
|
-
.filter((c) => !c.regex)
|
|
86
|
-
.map(async (cmd) => {
|
|
87
|
-
if (cmd.prefix) {
|
|
88
|
-
cmd.prefix.map((prefix) => {
|
|
89
|
-
if (message?.content?.startsWith(prefix)) {
|
|
90
|
-
command = message.content.replace(prefix, '').split(/ +/).shift();
|
|
91
|
-
px = prefix;
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
if (this.client.handlerOptions.message?.prefix) {
|
|
96
|
-
const prefix = Array.isArray(this.client.handlerOptions.message.prefix) ? this.client.handlerOptions.message.prefix : [this.client.handlerOptions.message.prefix];
|
|
97
|
-
prefix.map((prefix) => {
|
|
98
|
-
if (message?.content?.startsWith(prefix)) {
|
|
99
|
-
command = message.content.replace(prefix, '').split(/ +/).shift();
|
|
100
|
-
px = prefix;
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
if (this.client.handlerOptions.message?.allowMention) {
|
|
105
|
-
if (message.mentions.users.has(this.client.user?.id || '') || message.mentions.repliedUser?.id === this.client.user?.id) {
|
|
106
|
-
command = message?.content?.replace(`<@${this.client.user?.id}>`, '').trim().split(/ +/).shift();
|
|
107
|
-
px = 'MentionPrefix';
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
const prefix = Array.isArray(this.client.handlerOptions.message?.prefix) ? this.client.handlerOptions.message?.prefix : [this.client.handlerOptions.message?.prefix];
|
|
111
|
-
if (
|
|
112
|
-
(cmd.name.toLowerCase() == command?.toLowerCase() || cmd.aliases?.map((c) => c.toLowerCase())?.includes(command?.toLowerCase())) &&
|
|
113
|
-
(cmd.prefix.includes(px) || prefix?.includes(px) || px === 'MentionPrefix')
|
|
114
|
-
) {
|
|
115
|
-
try {
|
|
116
|
-
if (this.client.handlerOptions.message?.handleTyping) message.channel.sendTyping();
|
|
117
|
-
message = message;
|
|
118
|
-
const inhibitor = new InhibitorValidations_js_1.InhibitorValidation(this.client, message, command);
|
|
119
|
-
if ((0, CommandValidations_js_1.default)(message, cmd, this.client)) return;
|
|
120
|
-
if (await inhibitor.inhibit()) return;
|
|
121
|
-
if (cmd.conditions && (await cmd.conditions(message, await (0, CommandArguments_js_1.messageArguments)(message, cmd)))) return;
|
|
122
|
-
await cmd.exec(message, await (0, CommandArguments_js_1.messageArguments)(message, cmd));
|
|
123
|
-
this.client.emit('commandRun', message, cmd);
|
|
124
|
-
} catch (error) {
|
|
125
|
-
return this.client.emit('commandError', message, error, cmd);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
messageDelete() {
|
|
133
|
-
this.client.on('messageDelete', async (message) => {
|
|
134
|
-
if (this.client.cache.messages.has(message.id) && this.client.handlerOptions.message?.handleDeletes) {
|
|
135
|
-
try {
|
|
136
|
-
if (this.client.handlerOptions.message?.handleTyping) message.channel.sendTyping();
|
|
137
|
-
const msg = this.client.cache.messages.get(message.id);
|
|
138
|
-
const response = await message.channel.messages.fetch(msg?.response);
|
|
139
|
-
await response.delete();
|
|
140
|
-
} catch (error) {
|
|
141
|
-
this.client.emit('commandError', message, error, null);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
exports.MessageCommandEvents = MessageCommandEvents;
|
|
148
|
-
class SlashCommandEvents {
|
|
149
|
-
client;
|
|
150
|
-
constructor(client) {
|
|
151
|
-
this.client = client;
|
|
152
|
-
}
|
|
153
|
-
slashCreate() {
|
|
154
|
-
this.client.on('interactionCreate', async (interaction) => {
|
|
155
|
-
interaction.util = new CommandUtil_js_1.InteractionCommandUtil(this.client, interaction);
|
|
156
|
-
interaction.user.isOwner = this.client.util.isOwner(interaction.user.id);
|
|
157
|
-
if (interaction.type === discord_js_1.InteractionType.ApplicationCommand) {
|
|
158
|
-
if (this.client.commands.slash.has(interaction.commandName)) {
|
|
159
|
-
let command = this.client.commands.slash.get(interaction.commandName);
|
|
160
|
-
const argumentsInfo = new CommandArguments_js_1.InteractionArguments(interaction);
|
|
161
|
-
try {
|
|
162
|
-
const inhibitor = new InhibitorValidations_js_1.InhibitorValidation(this.client, interaction, command);
|
|
163
|
-
if (await inhibitor.inhibit()) return;
|
|
164
|
-
if ((0, CommandValidations_js_1.default)(interaction, command, this.client)) 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 (
|
|
176
|
-
command.conditions &&
|
|
177
|
-
(await command.conditions(interaction, {
|
|
178
|
-
group: argumentsInfo.group(),
|
|
179
|
-
subcommand: argumentsInfo.subcommand(),
|
|
180
|
-
args: await argumentsInfo.arguments(),
|
|
181
|
-
}))
|
|
182
|
-
)
|
|
183
|
-
return;
|
|
184
|
-
await command.exec(interaction, {
|
|
185
|
-
group: argumentsInfo.group(),
|
|
186
|
-
subcommand: argumentsInfo.subcommand(),
|
|
187
|
-
args: await argumentsInfo.arguments(),
|
|
188
|
-
});
|
|
189
|
-
this.client.emit('commandRun', interaction, command);
|
|
190
|
-
} catch (error) {
|
|
191
|
-
this.client.emit('commandError', interaction, error, command);
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
});
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
exports.SlashCommandEvents = SlashCommandEvents;
|
|
199
|
-
class ContextCommandEvents {
|
|
200
|
-
client;
|
|
201
|
-
constructor(client) {
|
|
202
|
-
this.client = client;
|
|
203
|
-
}
|
|
204
|
-
contextCreate() {
|
|
205
|
-
this.client.on('interactionCreate', async (interaction) => {
|
|
206
|
-
interaction.util = new CommandUtil_js_1.InteractionCommandUtil(this.client, interaction);
|
|
207
|
-
interaction.user.isOwner = this.client.util.isOwner(interaction.user.id);
|
|
208
|
-
if (interaction.type === discord_js_1.InteractionType.ApplicationCommand) {
|
|
209
|
-
if (this.client.commands.context.has(interaction.commandName)) {
|
|
210
|
-
let command = this.client.commands.context.get(interaction.commandName);
|
|
211
|
-
try {
|
|
212
|
-
const inhibitor = new InhibitorValidations_js_1.InhibitorValidation(this.client, interaction, command);
|
|
213
|
-
if ((0, CommandValidations_js_1.default)(interaction, command, this.client)) return;
|
|
214
|
-
if (await inhibitor.inhibit()) return;
|
|
215
|
-
if (command.conditions && (await command.conditions(interaction))) return;
|
|
216
|
-
if (command.defer?.reply !== false && this.client.handlerOptions.context?.defer?.reply)
|
|
217
|
-
await interaction.deferReply({
|
|
218
|
-
ephemeral: this.client.handlerOptions.context?.defer?.ephemeral,
|
|
219
|
-
fetchReply: this.client.handlerOptions.context?.defer?.fetchReply,
|
|
220
|
-
});
|
|
221
|
-
if (!(interaction.deferred || interaction.replied) && command.defer?.reply)
|
|
222
|
-
await interaction.deferReply({
|
|
223
|
-
ephemeral: command.defer?.ephemeral,
|
|
224
|
-
fetchReply: command.defer?.fetchReply,
|
|
225
|
-
});
|
|
226
|
-
let args = {};
|
|
227
|
-
if (command.type === 3) args = await interaction.channel.messages.fetch(interaction.targetId);
|
|
228
|
-
if (command.type === 2) args = await this.client.users.fetch(interaction.targetId);
|
|
229
|
-
await command.exec(interaction, args);
|
|
230
|
-
this.client.emit('commandRun', interaction, command);
|
|
231
|
-
} catch (error) {
|
|
232
|
-
this.client.emit('commandError', interaction, error, command);
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
});
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
exports.ContextCommandEvents = ContextCommandEvents;
|
|
240
|
-
class CommandsDeploy {
|
|
241
|
-
client;
|
|
242
|
-
constructor(client) {
|
|
243
|
-
this.client = client;
|
|
244
|
-
}
|
|
245
|
-
deploy() {
|
|
246
|
-
this.client.once('ready', async (client) => {
|
|
247
|
-
const slashCommands = [],
|
|
248
|
-
contextCommands = [];
|
|
249
|
-
this.client.commands.context.map((command) => (command.data ? contextCommands.push(command.data.toJSON()) : null));
|
|
250
|
-
this.client.commands.slash.map((command) => (command.data ? slashCommands.push(command.data.toJSON()) : null));
|
|
251
|
-
try {
|
|
252
|
-
const global = {
|
|
253
|
-
slash: this.client.handlerOptions.slash?.global,
|
|
254
|
-
context: this.client.handlerOptions.context?.global,
|
|
255
|
-
};
|
|
256
|
-
const guild = {
|
|
257
|
-
slash: this.client.handlerOptions.slash?.guildId,
|
|
258
|
-
context: this.client.handlerOptions.context?.guildId,
|
|
259
|
-
};
|
|
260
|
-
if (!guild.slash && !guild.context) return;
|
|
261
|
-
if (global.slash && global.context) {
|
|
262
|
-
if (guild.slash !== guild.context)
|
|
263
|
-
console.info(
|
|
264
|
-
dumfunctions_1.Style.log(
|
|
265
|
-
`Xernerx | Warning: slash and context commands are both set to global, but don't have a matching guildId, using ${
|
|
266
|
-
(await this.client.guilds.fetch(this.client.handlerOptions.slash?.guildId)).name
|
|
267
|
-
}!`,
|
|
268
|
-
{ color: dumfunctions_1.Style.TextColor.Red }
|
|
269
|
-
)
|
|
270
|
-
);
|
|
271
|
-
this.put('global', guild.slash, [...contextCommands, ...slashCommands]);
|
|
272
|
-
this.put('guild', guild.slash, []);
|
|
273
|
-
}
|
|
274
|
-
if (global.slash && global.context === false) {
|
|
275
|
-
this.put('global', guild.slash, slashCommands);
|
|
276
|
-
}
|
|
277
|
-
if (global.slash === false && global.context) {
|
|
278
|
-
this.put('global', guild.context, contextCommands);
|
|
279
|
-
}
|
|
280
|
-
if (global.slash === false && global.context === false) {
|
|
281
|
-
this.put('guild', guild.slash, [...contextCommands, ...slashCommands]);
|
|
282
|
-
}
|
|
283
|
-
if (this.client.handlerOptions.context?.logging || this.client.handlerOptions.slash?.logging)
|
|
284
|
-
console.info(
|
|
285
|
-
dumfunctions_1.Style.log(
|
|
286
|
-
`Xernerx | Deployed ${slashCommands.length} slash commands ${global.slash ? 'globally' : 'locally'} and ${contextCommands.length} context commands ${
|
|
287
|
-
global.context ? 'globally' : 'locally'
|
|
288
|
-
}.`,
|
|
289
|
-
{ color: dumfunctions_1.Style.TextColor.Purple }
|
|
290
|
-
)
|
|
291
|
-
);
|
|
292
|
-
} catch (error) {
|
|
293
|
-
console.error(
|
|
294
|
-
dumfunctions_1.Style.log(`Xernerx | Couldn't deploy interaction commands because <${error}>.`, {
|
|
295
|
-
color: dumfunctions_1.Style.BackgroundColor.Red,
|
|
296
|
-
})
|
|
297
|
-
);
|
|
298
|
-
}
|
|
299
|
-
});
|
|
300
|
-
}
|
|
301
|
-
put(type, guild, body) {
|
|
302
|
-
const rest = new discord_js_1.REST({ version: discord_js_1.GatewayVersion }).setToken(this.client.token);
|
|
303
|
-
if (type === 'guild') rest.put(discord_js_1.Routes.applicationGuildCommands(this.client.user?.id, guild), { body });
|
|
304
|
-
else rest.put(discord_js_1.Routes.applicationCommands(this.client.user?.id), { body });
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
exports.CommandsDeploy = CommandsDeploy;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3
|
-
const dumfunctions_1 = require('dumfunctions');
|
|
4
|
-
class Extensions {
|
|
5
|
-
client;
|
|
6
|
-
constructor(client) {
|
|
7
|
-
this.client = client;
|
|
8
|
-
}
|
|
9
|
-
async load(extensions, logging = false) {
|
|
10
|
-
const exts = [];
|
|
11
|
-
extensions.map((extension) => {
|
|
12
|
-
try {
|
|
13
|
-
this.client.extensions[extension.name] = extension;
|
|
14
|
-
exts.push(extension.name);
|
|
15
|
-
} catch (error) {
|
|
16
|
-
console.error(
|
|
17
|
-
dumfunctions_1.Style.log(`Xernerx | An error occurred trying to load ${extension.name}, error: <${error}>`, {
|
|
18
|
-
color: dumfunctions_1.Style.BackgroundColor.Red,
|
|
19
|
-
})
|
|
20
|
-
);
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
if (logging) console.info(dumfunctions_1.Style.log(`Xernerx | Loaded ${exts.length} extensions: ${exts.join(', ')}`, { color: dumfunctions_1.Style.TextColor.Cyan }));
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
exports.default = Extensions;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { Collection } from 'discord.js';
|
|
2
|
-
import CommandHandler from '../handlers/CommandHandler.js';
|
|
3
|
-
import EventHandler from '../handlers/EventHandler.js';
|
|
4
|
-
import InhibitorHandler from '../handlers/InhibitorHandler.js';
|
|
5
|
-
import MessageCommandBuilder from '../build/MessageCommandBuilder.js';
|
|
6
|
-
import ContextCommandBuilder from '../build/ContextCommandBuilder.js';
|
|
7
|
-
import SlashCommandBuilder from '../build/SlashCommandBuilder.js';
|
|
8
|
-
export interface ClientCommands {
|
|
9
|
-
message: Collection<string, MessageCommandBuilder>;
|
|
10
|
-
slash: Collection<string, SlashCommandBuilder>;
|
|
11
|
-
context: Collection<string, ContextCommandBuilder>;
|
|
12
|
-
}
|
|
13
|
-
export interface ClientCache {
|
|
14
|
-
messages: Collection<string, object>;
|
|
15
|
-
cooldowns: Collection<string, object>;
|
|
16
|
-
messageCommands: Collection<string, object>;
|
|
17
|
-
slashCommands: Collection<string, object>;
|
|
18
|
-
contextCommands: Collection<string, object>;
|
|
19
|
-
commands: Collection<string, object>;
|
|
20
|
-
}
|
|
21
|
-
export interface ClientModules {
|
|
22
|
-
commandHandler: CommandHandler;
|
|
23
|
-
eventHandler: EventHandler;
|
|
24
|
-
inhibitorHandler: InhibitorHandler;
|
|
25
|
-
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { TextChannel, Message, User, Guild, GuildMember, Channel, Role, InteractionResponse } from 'discord.js';
|
|
2
|
-
import { InteractionCommandUtil, MessageCommandUtil } from '../utils/CommandUtil.js';
|
|
3
|
-
export interface XernerxMessage extends Message {
|
|
4
|
-
util?: MessageCommandUtil;
|
|
5
|
-
response?: string;
|
|
6
|
-
}
|
|
7
|
-
export interface XernerxInteraction extends InteractionResponse {
|
|
8
|
-
util: InteractionCommandUtil;
|
|
9
|
-
options?: {
|
|
10
|
-
_group: string;
|
|
11
|
-
_subcommand: string;
|
|
12
|
-
_hoistedOptions: Array<{
|
|
13
|
-
name: string;
|
|
14
|
-
channel: Channel;
|
|
15
|
-
user: XernerxUser;
|
|
16
|
-
role: XernerxRole;
|
|
17
|
-
value: string;
|
|
18
|
-
}>;
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
export interface XernerxUser extends User {
|
|
22
|
-
isOwner: boolean;
|
|
23
|
-
}
|
|
24
|
-
export interface XernerxRole extends Role {}
|
|
25
|
-
export interface XernerxTextChannel extends TextChannel {}
|
|
26
|
-
export interface XernerxGuild extends Guild {}
|
|
27
|
-
export interface XernerxMember extends GuildMember {}
|
|
28
|
-
export type MessageCommandArgsTypes = 'rest' | 'option' | 'flag' | 'string' | 'number' | 'channel' | 'user' | 'member' | 'boolean' | 'role';
|
|
29
|
-
export type Localizations =
|
|
30
|
-
| 'id'
|
|
31
|
-
| 'da'
|
|
32
|
-
| 'de'
|
|
33
|
-
| 'en-GB'
|
|
34
|
-
| 'en-US'
|
|
35
|
-
| 'es-ES'
|
|
36
|
-
| 'fr'
|
|
37
|
-
| 'hr'
|
|
38
|
-
| 'it'
|
|
39
|
-
| 'lt'
|
|
40
|
-
| 'hu'
|
|
41
|
-
| 'nl'
|
|
42
|
-
| 'no'
|
|
43
|
-
| 'pl'
|
|
44
|
-
| 'pt-BR'
|
|
45
|
-
| 'ro'
|
|
46
|
-
| 'fi'
|
|
47
|
-
| 'sv-SE'
|
|
48
|
-
| 'vi'
|
|
49
|
-
| 'tr'
|
|
50
|
-
| 'cs'
|
|
51
|
-
| 'el'
|
|
52
|
-
| 'bg'
|
|
53
|
-
| 'ru'
|
|
54
|
-
| 'uk'
|
|
55
|
-
| 'hi'
|
|
56
|
-
| 'th'
|
|
57
|
-
| 'zh-CN'
|
|
58
|
-
| 'ja'
|
|
59
|
-
| 'zh-TW'
|
|
60
|
-
| 'ko';
|
|
61
|
-
export type EventEmitterType = 'client' | 'process';
|
package/dist/cjs/types/types.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { ActivityType, ClientPresenceStatus } from 'discord.js';
|
|
2
|
-
import XernerxClient from '../client/XernerxClient.js';
|
|
3
|
-
interface Presence {
|
|
4
|
-
text?: string;
|
|
5
|
-
type?: ActivityType.Playing | ActivityType.Streaming | ActivityType.Listening | ActivityType.Watching | ActivityType.Competing;
|
|
6
|
-
link?: string;
|
|
7
|
-
status?: ClientPresenceStatus;
|
|
8
|
-
interval?: number;
|
|
9
|
-
}
|
|
10
|
-
export declare class ClientUtil {
|
|
11
|
-
client: XernerxClient;
|
|
12
|
-
constructor(client: XernerxClient);
|
|
13
|
-
uptime(timestamp: number | null): string;
|
|
14
|
-
getSubcommands(name: string): object[];
|
|
15
|
-
isOwner(userId: string): boolean;
|
|
16
|
-
getAllCommands(): object[];
|
|
17
|
-
getAllMessageCommands(): object[];
|
|
18
|
-
getAllSlashCommands(): object[];
|
|
19
|
-
getAllContextCommands(): object[];
|
|
20
|
-
setPresence(options: Presence): void;
|
|
21
|
-
getCooldowns(id: string, command?: string): any;
|
|
22
|
-
getCooldownTimers(id: string, command?: string): any;
|
|
23
|
-
defer(time: number): Promise<unknown>;
|
|
24
|
-
}
|
|
25
|
-
export {};
|