xernerx 2.7.4 → 3.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.
Files changed (76) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +0 -0
  3. package/dist/build/ContextCommand.d.ts +39 -0
  4. package/dist/build/ContextCommand.js +86 -0
  5. package/dist/build/Event.d.ts +15 -0
  6. package/dist/build/Event.js +31 -0
  7. package/dist/build/Inhibitor.d.ts +12 -0
  8. package/dist/build/Inhibitor.js +20 -0
  9. package/dist/build/MessageCommand.d.ts +39 -0
  10. package/dist/build/MessageCommand.js +77 -0
  11. package/dist/build/SlashCommand.d.ts +32 -0
  12. package/dist/build/SlashCommand.js +119 -0
  13. package/dist/client/XernerxClient.d.ts +22 -0
  14. package/dist/client/XernerxClient.js +76 -0
  15. package/dist/handlers/CommandHandler.d.ts +27 -0
  16. package/dist/handlers/CommandHandler.js +42 -0
  17. package/dist/handlers/EventHandler.d.ts +13 -0
  18. package/dist/handlers/EventHandler.js +16 -0
  19. package/dist/handlers/Handler.d.ts +37 -0
  20. package/dist/handlers/Handler.js +242 -0
  21. package/dist/handlers/InhibitorHandler.d.ts +18 -0
  22. package/dist/handlers/InhibitorHandler.js +21 -0
  23. package/dist/interfaces/ClientInterfaces.d.ts +58 -0
  24. package/dist/interfaces/ClientInterfaces.js +1 -0
  25. package/dist/interfaces/CommandInterfaces.d.ts +94 -0
  26. package/dist/interfaces/CommandInterfaces.js +1 -0
  27. package/dist/interfaces/HandlerInterfaces.d.ts +70 -0
  28. package/dist/interfaces/HandlerInterfaces.js +1 -0
  29. package/dist/main.d.ts +26 -0
  30. package/dist/main.js +40 -0
  31. package/dist/models/CommandArguments.d.ts +9 -0
  32. package/dist/models/CommandArguments.js +128 -0
  33. package/dist/models/CommandValidations.d.ts +3 -0
  34. package/dist/models/CommandValidations.js +193 -0
  35. package/dist/models/Events.d.ts +23 -0
  36. package/dist/models/Events.js +328 -0
  37. package/dist/models/Functions.d.ts +1 -0
  38. package/dist/models/Functions.js +30 -0
  39. package/dist/models/InhibitorValidations.d.ts +17 -0
  40. package/dist/models/InhibitorValidations.js +42 -0
  41. package/dist/types/EventTypes.d.ts +1 -0
  42. package/dist/types/EventTypes.js +1 -0
  43. package/dist/types/InhibitorTypes.d.ts +12 -0
  44. package/dist/types/InhibitorTypes.js +13 -0
  45. package/dist/types/Types.d.ts +24 -0
  46. package/dist/types/Types.js +21 -0
  47. package/dist/utils/ClientUtil.d.ts +25 -0
  48. package/dist/utils/ClientUtil.js +232 -0
  49. package/dist/utils/CommandUtil.d.ts +24 -0
  50. package/dist/utils/CommandUtil.js +163 -0
  51. package/package.json +5 -8
  52. package/main.js +0 -49
  53. package/models/Client.js +0 -60
  54. package/models/commands/ContextMenuCommand.js +0 -68
  55. package/models/commands/Event.js +0 -33
  56. package/models/commands/Inhibitor.js +0 -31
  57. package/models/commands/InteractionCommand.js +0 -142
  58. package/models/commands/MessageCommand.js +0 -86
  59. package/models/data/colors.json +0 -16
  60. package/models/data/options.json +0 -27
  61. package/models/events/interactionCreate.js +0 -84
  62. package/models/events/messageCreate.js +0 -84
  63. package/models/events/messageUpdate.js +0 -83
  64. package/models/events/readyOnce.js +0 -58
  65. package/models/handlers/CommandHandler.js +0 -37
  66. package/models/handlers/EventHandler.js +0 -67
  67. package/models/handlers/Handler.js +0 -111
  68. package/models/handlers/InhibitorHandler.js +0 -16
  69. package/models/handlers/LanguageHandler.js +0 -37
  70. package/models/utils/Arguments.js +0 -120
  71. package/models/utils/CommandValidation.js +0 -96
  72. package/models/utils/CommandsUtil.js +0 -70
  73. package/models/utils/Functions.js +0 -266
  74. package/models/utils/InhibitorsUtil.js +0 -24
  75. package/models/utils/InhibitorsValidation.js +0 -40
  76. package/models/utils/Util.js +0 -96
@@ -0,0 +1,328 @@
1
+ import { GatewayVersion, InteractionType, REST, Routes, } from "discord.js";
2
+ import { InteractionCommandUtil, MessageCommandUtil, } from "../utils/CommandUtil.js";
3
+ import { CommandArguments, messageArgs } from "./CommandArguments.js";
4
+ import commandValidation from "./CommandValidations.js";
5
+ import { logStyle } from "./Functions.js";
6
+ import { InhibitorValidation } from "./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
26
+ .replace(prefix, "")
27
+ .split(/ +/)
28
+ .shift();
29
+ px = prefix;
30
+ }
31
+ });
32
+ }
33
+ if (this.client.handlerOptions.message?.prefix) {
34
+ const prefix = Array.isArray(this.client.handlerOptions.message.prefix)
35
+ ? this.client.handlerOptions.message.prefix
36
+ : [this.client.handlerOptions.message.prefix];
37
+ prefix.map((prefix) => {
38
+ if (message.content.startsWith(prefix)) {
39
+ command = message.content
40
+ .replace(prefix, "")
41
+ .split(/ +/)
42
+ .shift();
43
+ px = prefix;
44
+ }
45
+ });
46
+ }
47
+ if (this.client.handlerOptions.message?.allowMention) {
48
+ if (message.mentions.users.has(this.client.user?.id || "") ||
49
+ message.mentions.repliedUser?.id === this.client.user?.id) {
50
+ command = message.content
51
+ .replace(`<@${this.client.user?.id}>`, "")
52
+ .trim()
53
+ .split(/ +/)
54
+ .shift();
55
+ px = "MentionPrefix";
56
+ }
57
+ }
58
+ const prefix = Array.isArray(this.client.handlerOptions.message?.prefix)
59
+ ? this.client.handlerOptions.message?.prefix
60
+ : [this.client.handlerOptions.message?.prefix];
61
+ if ((cmd.name.toLowerCase() == command?.toLowerCase() ||
62
+ cmd.aliases
63
+ ?.map((c) => c.toLowerCase())
64
+ ?.includes(command?.toLowerCase())) &&
65
+ (cmd.prefix.includes(px) ||
66
+ prefix?.includes(px) ||
67
+ px === "MentionPrefix")) {
68
+ try {
69
+ const inhibitor = new InhibitorValidation(this.client, message, command);
70
+ if (commandValidation(message, cmd, this.client))
71
+ return;
72
+ if (await inhibitor.inhibit())
73
+ return;
74
+ if (cmd.conditions && (await cmd.conditions(message)))
75
+ return;
76
+ await cmd.exec(message, await messageArgs(message, cmd));
77
+ this.client.emit("commandRun", message, cmd);
78
+ }
79
+ catch (error) {
80
+ return this.client.emit("commandError", message, error);
81
+ }
82
+ }
83
+ });
84
+ }
85
+ });
86
+ }
87
+ messageUpdate() {
88
+ this.client.on("messageUpdate", async (old, message) => {
89
+ message = message; // could just do this
90
+ if (!message.author?.bot) {
91
+ let command = undefined, px = undefined;
92
+ if (message.author)
93
+ message.author.isOwner = this.client.util.isOwner(message.author.id);
94
+ message.util = new MessageCommandUtil(this.client, message);
95
+ const commands = this.client.commands.message;
96
+ commands
97
+ .filter((c) => !c.regex)
98
+ .map(async (cmd) => {
99
+ if (cmd.prefix) {
100
+ cmd.prefix.map((prefix) => {
101
+ if (message?.content?.startsWith(prefix)) {
102
+ command = message.content
103
+ .replace(prefix, "")
104
+ .split(/ +/)
105
+ .shift();
106
+ px = prefix;
107
+ }
108
+ });
109
+ }
110
+ if (this.client.handlerOptions.message?.prefix) {
111
+ const prefix = Array.isArray(this.client.handlerOptions.message.prefix)
112
+ ? this.client.handlerOptions.message.prefix
113
+ : [this.client.handlerOptions.message.prefix];
114
+ prefix.map((prefix) => {
115
+ if (message?.content?.startsWith(prefix)) {
116
+ command = message.content
117
+ .replace(prefix, "")
118
+ .split(/ +/)
119
+ .shift();
120
+ px = prefix;
121
+ }
122
+ });
123
+ }
124
+ if (this.client.handlerOptions.message?.allowMention) {
125
+ if (message.mentions.users.has(this.client.user?.id || "") ||
126
+ message.mentions.repliedUser?.id === this.client.user?.id) {
127
+ command = message?.content
128
+ ?.replace(`<@${this.client.user?.id}>`, "")
129
+ .trim()
130
+ .split(/ +/)
131
+ .shift();
132
+ px = "MentionPrefix";
133
+ }
134
+ }
135
+ const prefix = Array.isArray(this.client.handlerOptions.message?.prefix)
136
+ ? this.client.handlerOptions.message?.prefix
137
+ : [this.client.handlerOptions.message?.prefix];
138
+ if ((cmd.name.toLowerCase() == command?.toLowerCase() ||
139
+ cmd.aliases
140
+ ?.map((c) => c.toLowerCase())
141
+ ?.includes(command?.toLowerCase())) &&
142
+ (cmd.prefix.includes(px) ||
143
+ prefix?.includes(px) ||
144
+ px === "MentionPrefix")) {
145
+ try {
146
+ const inhibitor = new InhibitorValidation(this.client, message, command);
147
+ if (commandValidation(message, cmd, this.client))
148
+ return;
149
+ if (await inhibitor.inhibit())
150
+ return;
151
+ if (cmd.conditions && (await cmd.conditions(message)))
152
+ return;
153
+ await cmd.exec(message, await messageArgs(message, cmd));
154
+ this.client.emit("commandRun", message, cmd);
155
+ }
156
+ catch (error) {
157
+ return this.client.emit("commandError", message, error);
158
+ }
159
+ }
160
+ });
161
+ }
162
+ });
163
+ }
164
+ messageDelete() {
165
+ this.client.on("messageDelete", async (message) => {
166
+ if (this.client.cache.messages.has(message.id) &&
167
+ this.client.handlerOptions.message?.handleDeletes) {
168
+ try {
169
+ const msg = this.client.cache.messages.get(message.id);
170
+ const response = await message.channel.messages.fetch(msg?.response);
171
+ await response.delete();
172
+ }
173
+ catch { }
174
+ }
175
+ });
176
+ }
177
+ }
178
+ export class SlashCommandEvents {
179
+ client;
180
+ constructor(client) {
181
+ this.client = client;
182
+ }
183
+ slashCreate() {
184
+ this.client.on("interactionCreate", async (interaction) => {
185
+ interaction.util = new InteractionCommandUtil(this.client, interaction);
186
+ interaction.user.isOwner = this.client.util.isOwner(interaction.user.id);
187
+ if (interaction.type === InteractionType.ApplicationCommand) {
188
+ if (this.client.commands.slash.has(interaction.commandName)) {
189
+ let command = this.client.commands.slash.get(interaction.commandName);
190
+ const argumentsInfo = new CommandArguments(interaction);
191
+ try {
192
+ const inhibitor = new InhibitorValidation(this.client, interaction, command);
193
+ if (await inhibitor.inhibit())
194
+ return;
195
+ if (commandValidation(interaction, command, this.client))
196
+ return;
197
+ if (command.defer?.reply !== false &&
198
+ this.client.handlerOptions.slash?.defer?.reply) {
199
+ await interaction.deferReply({
200
+ ephemeral: this.client.handlerOptions.slash?.defer?.ephemeral,
201
+ fetchReply: this.client.handlerOptions.slash?.defer?.fetchReply,
202
+ });
203
+ }
204
+ if (!(interaction.deferred || interaction.replied) &&
205
+ command.defer?.reply) {
206
+ await interaction.deferReply({
207
+ ephemeral: command.defer?.ephemeral,
208
+ fetchReply: command.defer?.fetchReply,
209
+ });
210
+ }
211
+ if (command.conditions &&
212
+ (await command.conditions(interaction, {
213
+ group: argumentsInfo.group(),
214
+ subcommand: argumentsInfo.subcommand(),
215
+ args: await argumentsInfo.arguments(),
216
+ })))
217
+ return;
218
+ await command.exec(interaction, {
219
+ group: argumentsInfo.group(),
220
+ subcommand: argumentsInfo.subcommand(),
221
+ args: await argumentsInfo.arguments(),
222
+ });
223
+ this.client.emit("commandRun", interaction, command);
224
+ }
225
+ catch (error) {
226
+ this.client.emit("commandError", interaction, error);
227
+ }
228
+ }
229
+ }
230
+ });
231
+ }
232
+ }
233
+ export class ContextCommandEvents {
234
+ client;
235
+ constructor(client) {
236
+ this.client = client;
237
+ }
238
+ contextCreate() {
239
+ this.client.on("interactionCreate", async (interaction) => {
240
+ interaction.util = new InteractionCommandUtil(this.client, interaction);
241
+ interaction.user.isOwner = this.client.util.isOwner(interaction.user.id);
242
+ if (interaction.type === InteractionType.ApplicationCommand) {
243
+ if (this.client.commands.context.has(interaction.commandName)) {
244
+ let command = this.client.commands.context.get(interaction.commandName);
245
+ try {
246
+ const inhibitor = new InhibitorValidation(this.client, interaction, command);
247
+ if (commandValidation(interaction, command, this.client))
248
+ return;
249
+ if (await inhibitor.inhibit())
250
+ return;
251
+ if (command.conditions && (await command.conditions(interaction)))
252
+ return;
253
+ if (command.defer?.reply !== false &&
254
+ this.client.handlerOptions.context?.defer?.reply) {
255
+ await interaction.deferReply({
256
+ ephemeral: this.client.handlerOptions.context?.defer?.ephemeral,
257
+ fetchReply: this.client.handlerOptions.context?.defer?.fetchReply,
258
+ });
259
+ }
260
+ if (!(interaction.deferred || interaction.replied) &&
261
+ command.defer?.reply) {
262
+ await interaction.deferReply({
263
+ ephemeral: command.defer?.ephemeral,
264
+ fetchReply: command.defer?.fetchReply,
265
+ });
266
+ }
267
+ await command.exec(interaction);
268
+ this.client.emit("commandRun", interaction, command);
269
+ }
270
+ catch (error) {
271
+ this.client.emit("commandError", interaction, error);
272
+ }
273
+ }
274
+ }
275
+ });
276
+ }
277
+ }
278
+ export class CommandsDeploy {
279
+ client;
280
+ constructor(client) {
281
+ this.client = client;
282
+ }
283
+ deploy() {
284
+ this.client.once("ready", async (client) => {
285
+ const rest = new REST({ version: GatewayVersion }).setToken(client.token);
286
+ const commands = [
287
+ ...this.client.commands.context,
288
+ ...this.client.commands.slash,
289
+ ];
290
+ const deployableCommands = [];
291
+ commands.map((commands) => commands.map((command) => {
292
+ if (command?.data) {
293
+ deployableCommands.push(command.data.toJSON());
294
+ }
295
+ }));
296
+ try {
297
+ if (this.client.handlerOptions.context?.global === true ||
298
+ this.client.handlerOptions.slash?.global === true) {
299
+ rest.put(Routes.applicationCommands(client.user.id), {
300
+ body: deployableCommands,
301
+ });
302
+ rest.put(Routes.applicationGuildCommands(client.user.id, this.client.handlerOptions.slash?.guildId ||
303
+ this.client.handlerOptions.context?.guildId ||
304
+ ""), {
305
+ body: [],
306
+ });
307
+ }
308
+ if (this.client.handlerOptions.context?.global === false ||
309
+ this.client.handlerOptions.slash?.global === false) {
310
+ rest.put(Routes.applicationGuildCommands(client.user.id, this.client.handlerOptions.slash?.guildId ||
311
+ this.client.handlerOptions.context?.guildId ||
312
+ ""), {
313
+ body: deployableCommands,
314
+ });
315
+ }
316
+ if (this.client.handlerOptions.slash?.logging ||
317
+ this.client.handlerOptions?.context?.logging)
318
+ console.info(logStyle(`Xernerx | Deployed ${deployableCommands.length} of ${commands.length} interaction commands ${this.client.handlerOptions.slash?.global ||
319
+ this.client.handlerOptions.context?.global
320
+ ? `globally in ${(await this.client.guilds.fetch()).size} server(s), deleted local commands.`
321
+ : "locally"}.`, "text", "purple"));
322
+ }
323
+ catch (error) {
324
+ console.error(logStyle(`Xernerx | Couldn't deploy interaction commands because <${error}>.`, "background", "red"));
325
+ }
326
+ });
327
+ }
328
+ }
@@ -0,0 +1 @@
1
+ export declare function logStyle(text: string, type: string, color: string): string | undefined;
@@ -0,0 +1,30 @@
1
+ export function logStyle(text, type, color) {
2
+ if (type.toLowerCase() == "text") {
3
+ if (color.toLowerCase() == "red")
4
+ return `\u001b[0;31m${text}\u001b[0;0m`;
5
+ if (color.toLowerCase() == "green")
6
+ return `\u001b[0;32m${text}\u001b[0;0m`;
7
+ if (color.toLowerCase() == "yellow")
8
+ return `\u001b[0;33m${text}\u001b[0;0m`;
9
+ if (color.toLowerCase() == "blue")
10
+ return `\u001b[0;34m${text}\u001b[0;0m`;
11
+ if (color.toLowerCase() == "purple")
12
+ return `\u001b[0;35m${text}\u001b[0;0m`;
13
+ if (color.toLowerCase() == "cyan")
14
+ return `\u001b[0;36m${text}\u001b[0;0m`;
15
+ }
16
+ if (type.toLowerCase() == `background`) {
17
+ if (color.toLowerCase() == "red")
18
+ return `\u001b[0;41m${text}\u001b[0;0m`;
19
+ if (color.toLowerCase() == "green")
20
+ return `\u001b[0;42m${text}\u001b[0;0m`;
21
+ if (color.toLowerCase() == "yellow")
22
+ return `\u001b[0;43m${text}\u001b[0;0m`;
23
+ if (color.toLowerCase() == "blue")
24
+ return `\u001b[0;44m${text}\u001b[0;0m`;
25
+ if (color.toLowerCase() == "purple")
26
+ return `\u001b[0;45m${text}\u001b[0;0m`;
27
+ if (color.toLowerCase() == "cyan")
28
+ return `\u001b[0;46m${text}\u001b[0;0m`;
29
+ }
30
+ }
@@ -0,0 +1,17 @@
1
+ import { Interaction, Message } from "discord.js";
2
+ import { MessageCommandOptions, SlashCommandOptions, ContextCommandOptions } from "../interfaces/CommandInterfaces.js";
3
+ import { InhibitorType } from "../types/InhibitorTypes.js";
4
+ import XernerxClient from "../client/XernerxClient.js";
5
+ export declare class InhibitorValidation {
6
+ client: XernerxClient;
7
+ action: Message | Interaction;
8
+ command: MessageCommandOptions | SlashCommandOptions | ContextCommandOptions;
9
+ inhibited: {
10
+ [index: string]: any;
11
+ };
12
+ constructor(client: XernerxClient, action: Message | Interaction, command: any);
13
+ inhibit(): Promise<{
14
+ [index: string]: any;
15
+ } | undefined>;
16
+ args(action: any, type: InhibitorType): any;
17
+ }
@@ -0,0 +1,42 @@
1
+ import { InhibitorType } from "../types/InhibitorTypes.js";
2
+ export class InhibitorValidation {
3
+ client;
4
+ action;
5
+ command;
6
+ inhibited;
7
+ constructor(client, action, command) {
8
+ this.client = client;
9
+ this.action = action;
10
+ this.command = command;
11
+ this.inhibited = {};
12
+ }
13
+ async inhibit() {
14
+ for (const inhibitor of this.client.inhibitors) {
15
+ const inhibit = inhibitor[1];
16
+ if (inhibit)
17
+ this.inhibited[inhibit.name] = await inhibit.check(this.action, this.args(this.action, inhibit.type));
18
+ }
19
+ for (const inhibit of Object.values(this.inhibited)) {
20
+ if (inhibit)
21
+ return this.inhibited;
22
+ }
23
+ }
24
+ args(action, type) {
25
+ if (type === InhibitorType.Channel)
26
+ return action.channel;
27
+ if (type === InhibitorType.User)
28
+ return action.author || action.user;
29
+ if (type === InhibitorType.Guild)
30
+ return action.guild;
31
+ if (type === InhibitorType.Member)
32
+ return action.member;
33
+ // if (type === InhibitorType.Command)
34
+ // return this.client.util.getAllCommands().filter(this.command.name);
35
+ // if (type === InhibitorType.MessageCommand)
36
+ // return this.client.util.getAllMessageCommands().find(this.command.name);
37
+ // if (type === InhibitorType.SlashCommand)
38
+ // return this.client.util.getAllSlashCommands().find(this.command.name);
39
+ // if (type === InhibitorType.ContextCommand)
40
+ // return this.client.util.getAllContextCommands().find(this.command.name);
41
+ }
42
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,12 @@
1
+ export declare enum InhibitorType {
2
+ Member = "Member",
3
+ User = "User",
4
+ Guild = "Guild",
5
+ SlashCommand = "SlashCommand",
6
+ MessageCommand = "MessageCommand",
7
+ ContextCommand = "ContextCommand",
8
+ Command = "Command",
9
+ Message = "Message",
10
+ Interaction = "Interaction",
11
+ Channel = "Channel"
12
+ }
@@ -0,0 +1,13 @@
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 = {}));
@@ -0,0 +1,24 @@
1
+ import { SlashCommandStringOption, SlashCommandNumberOption, SlashCommandIntegerOption, SlashCommandBooleanOption, SlashCommandUserOption, SlashCommandChannelOption, SlashCommandRoleOption, SlashCommandMentionableOption } from "discord.js";
2
+ export declare enum CommandType {
3
+ Message = "MessageCommand",
4
+ Slash = "SlashCommand",
5
+ Context = "ContextCommand",
6
+ Event = "Event",
7
+ Inhibitor = "Inhibitor",
8
+ MessageCommand = "MessageCommand",
9
+ SlashCommand = "SlashCommand",
10
+ ContextCommand = "ContextCommand"
11
+ }
12
+ export declare enum EventEmitterType {
13
+ Client = "client",
14
+ Rest = "rest",
15
+ Process = "process"
16
+ }
17
+ export declare type SlashCommandOptionChoices = SlashCommandStringOption | SlashCommandNumberOption | SlashCommandIntegerOption;
18
+ export declare type SlashCommandOption = SlashCommandOptionChoices | SlashCommandBooleanOption | SlashCommandUserOption | SlashCommandChannelOption | SlashCommandRoleOption | SlashCommandMentionableOption;
19
+ export declare type NiceTypes = "String" | "Number" | "Boolean" | "User" | "Channel" | "Role" | "Mentionable" | "Integer";
20
+ declare const _default: {
21
+ CommandType: typeof CommandType;
22
+ EventEmitterType: typeof EventEmitterType;
23
+ };
24
+ export default _default;
@@ -0,0 +1,21 @@
1
+ export var CommandType;
2
+ (function (CommandType) {
3
+ CommandType["Message"] = "MessageCommand";
4
+ CommandType["Slash"] = "SlashCommand";
5
+ CommandType["Context"] = "ContextCommand";
6
+ CommandType["Event"] = "Event";
7
+ CommandType["Inhibitor"] = "Inhibitor";
8
+ CommandType["MessageCommand"] = "MessageCommand";
9
+ CommandType["SlashCommand"] = "SlashCommand";
10
+ CommandType["ContextCommand"] = "ContextCommand";
11
+ })(CommandType = CommandType || (CommandType = {}));
12
+ export var EventEmitterType;
13
+ (function (EventEmitterType) {
14
+ EventEmitterType["Client"] = "client";
15
+ EventEmitterType["Rest"] = "rest";
16
+ EventEmitterType["Process"] = "process";
17
+ })(EventEmitterType = EventEmitterType || (EventEmitterType = {}));
18
+ export default {
19
+ CommandType,
20
+ EventEmitterType,
21
+ };
@@ -0,0 +1,25 @@
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 {};