xernerx 3.2.5 → 3.3.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 (58) hide show
  1. package/dist/build/ContextCommand.d.ts +1 -1
  2. package/dist/build/ContextCommand.js +1 -1
  3. package/dist/build/ContextCommandBuilder.d.ts +40 -0
  4. package/dist/build/ContextCommandBuilder.js +84 -0
  5. package/dist/build/Event.d.ts +1 -1
  6. package/dist/build/Event.js +1 -1
  7. package/dist/build/EventBuilder.d.ts +17 -0
  8. package/dist/build/EventBuilder.js +35 -0
  9. package/dist/build/ExtensionBuilder.d.ts +7 -0
  10. package/dist/build/ExtensionBuilder.js +9 -0
  11. package/dist/build/Inhibitor.d.ts +3 -0
  12. package/dist/build/Inhibitor.js +3 -0
  13. package/dist/build/InhibitorBuilder.d.ts +19 -0
  14. package/dist/build/InhibitorBuilder.js +28 -0
  15. package/dist/build/MessageCommand.d.ts +2 -2
  16. package/dist/build/MessageCommand.js +1 -1
  17. package/dist/build/MessageCommandBuilder.d.ts +42 -0
  18. package/dist/build/MessageCommandBuilder.js +80 -0
  19. package/dist/build/SlashCommand.d.ts +3 -3
  20. package/dist/build/SlashCommand.js +3 -3
  21. package/dist/build/SlashCommandBuilder.d.ts +36 -0
  22. package/dist/build/SlashCommandBuilder.js +125 -0
  23. package/dist/build/XernerxExtension.d.ts +7 -0
  24. package/dist/build/XernerxExtension.js +9 -0
  25. package/dist/client/XernerxClient.d.ts +11 -7
  26. package/dist/client/XernerxClient.js +0 -2
  27. package/dist/handlers/CommandHandler.d.ts +4 -4
  28. package/dist/handlers/EventHandler.d.ts +2 -2
  29. package/dist/handlers/Handler.d.ts +6 -6
  30. package/dist/handlers/Handler.js +2 -1
  31. package/dist/handlers/InhibitorHandler.d.ts +2 -2
  32. package/dist/interfaces/ClientInterfaces.d.ts +8 -7
  33. package/dist/interfaces/CommandInterfaces.d.ts +1 -1
  34. package/dist/interfaces/HandlerInterfaces.d.ts +3 -11
  35. package/dist/main.d.ts +14 -13
  36. package/dist/main.js +16 -15
  37. package/dist/models/CommandArguments.d.ts +15 -7
  38. package/dist/models/CommandArguments.js +27 -33
  39. package/dist/models/CommandValidations.d.ts +4 -3
  40. package/dist/models/CommandValidations.js +9 -17
  41. package/dist/models/Events.d.ts +1 -0
  42. package/dist/models/Events.js +67 -140
  43. package/dist/models/Extensions.d.ts +2 -2
  44. package/dist/models/InhibitorValidations.d.ts +8 -13
  45. package/dist/models/InhibitorValidations.js +1 -1
  46. package/dist/types/Types.d.ts +29 -25
  47. package/dist/types/Types.js +1 -26
  48. package/dist/types/enums.d.ts +35 -0
  49. package/dist/types/enums.js +35 -0
  50. package/dist/types/interfaces.d.ts +25 -0
  51. package/dist/types/interfaces.js +1 -0
  52. package/dist/types/objects.d.ts +18 -0
  53. package/dist/types/objects.js +1 -0
  54. package/dist/types/options.d.ts +204 -0
  55. package/dist/types/options.js +1 -0
  56. package/dist/utils/ClientUtil.js +1 -2
  57. package/dist/utils/CommandUtil.d.ts +3 -3
  58. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  import { GatewayVersion, InteractionType, REST, Routes, } from "discord.js";
2
2
  import { InteractionCommandUtil, MessageCommandUtil, } from "../utils/CommandUtil.js";
3
- import { CommandArguments, messageArgs } from "./CommandArguments.js";
3
+ import { InteractionArguments, messageArguments } from "./CommandArguments.js";
4
4
  import commandValidation from "./CommandValidations.js";
5
5
  import { Style } from "dumfunctions";
6
6
  import { InhibitorValidation } from "./InhibitorValidations.js";
@@ -13,67 +13,48 @@ export class MessageCommandEvents {
13
13
  this.client.on("messageCreate", async (message) => {
14
14
  if (!message.author.bot) {
15
15
  let command = undefined, px = undefined;
16
+ if (this.client.handlerOptions.message?.handleTyping)
17
+ message.channel.sendTyping();
16
18
  message.author.isOwner = this.client.util.isOwner(message.author.id);
17
19
  message.util = new MessageCommandUtil(this.client, message);
18
20
  const commands = this.client.commands.message;
19
21
  commands
20
- .filter((c) => !c.regex)
22
+ .filter(c => !c.regex)
21
23
  .map(async (cmd) => {
22
24
  if (cmd.prefix) {
23
- cmd.prefix.map((prefix) => {
25
+ cmd.prefix.map(prefix => {
24
26
  if (message.content.startsWith(prefix)) {
25
- command = message.content
26
- .replace(prefix, "")
27
- .split(/ +/)
28
- .shift();
27
+ command = message.content.replace(prefix, "").split(/ +/).shift();
29
28
  px = prefix;
30
29
  }
31
30
  });
32
31
  }
33
32
  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];
33
+ const prefix = Array.isArray(this.client.handlerOptions.message.prefix) ? this.client.handlerOptions.message.prefix : [this.client.handlerOptions.message.prefix];
37
34
  prefix.map((prefix) => {
38
35
  if (message.content.startsWith(prefix)) {
39
- command = message.content
40
- .replace(prefix, "")
41
- .split(/ +/)
42
- .shift();
36
+ command = message.content.replace(prefix, "").split(/ +/).shift();
43
37
  px = prefix;
44
38
  }
45
39
  });
46
40
  }
47
41
  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();
42
+ if (message.mentions.users.has(this.client.user?.id) || message.mentions.repliedUser?.id === this.client.user?.id) {
43
+ command = message.content.replace(`<@${this.client.user?.id}>`, "").trim().split(/ +/).shift();
55
44
  px = "MentionPrefix";
56
45
  }
57
46
  }
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")) {
47
+ const prefix = Array.isArray(this.client.handlerOptions.message?.prefix) ? this.client.handlerOptions.message?.prefix : [this.client.handlerOptions.message?.prefix];
48
+ if ((cmd.name.toLowerCase() == command?.toLowerCase() || cmd.aliases?.map((c) => c.toLowerCase())?.includes(command?.toLowerCase())) && (cmd.prefix.includes(px) || prefix?.includes(px) || px === "MentionPrefix")) {
68
49
  try {
69
50
  const inhibitor = new InhibitorValidation(this.client, message, command);
70
51
  if (commandValidation(message, cmd, this.client))
71
52
  return;
72
53
  if (await inhibitor.inhibit())
73
54
  return;
74
- if (cmd.conditions && (await cmd.conditions(message)))
55
+ if (cmd.conditions && await cmd.conditions(message, await messageArguments(message, cmd)))
75
56
  return;
76
- await cmd.exec(message, await messageArgs(message, cmd));
57
+ await cmd.exec(message, await messageArguments(message, cmd));
77
58
  this.client.emit("commandRun", message, cmd);
78
59
  }
79
60
  catch (error) {
@@ -86,9 +67,11 @@ export class MessageCommandEvents {
86
67
  }
87
68
  messageUpdate() {
88
69
  this.client.on("messageUpdate", async (old, message) => {
89
- message = message; // could just do this
70
+ message = message;
90
71
  if (!message.author?.bot) {
91
72
  let command = undefined, px = undefined;
73
+ if (this.client.handlerOptions.message?.handleTyping)
74
+ message.channel.sendTyping();
92
75
  if (message.author)
93
76
  message.author.isOwner = this.client.util.isOwner(message.author.id);
94
77
  message.util = new MessageCommandUtil(this.client, message);
@@ -99,58 +82,38 @@ export class MessageCommandEvents {
99
82
  if (cmd.prefix) {
100
83
  cmd.prefix.map((prefix) => {
101
84
  if (message?.content?.startsWith(prefix)) {
102
- command = message.content
103
- .replace(prefix, "")
104
- .split(/ +/)
105
- .shift();
85
+ command = message.content.replace(prefix, "").split(/ +/).shift();
106
86
  px = prefix;
107
87
  }
108
88
  });
109
89
  }
110
90
  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];
91
+ const prefix = Array.isArray(this.client.handlerOptions.message.prefix) ? this.client.handlerOptions.message.prefix : [this.client.handlerOptions.message.prefix];
114
92
  prefix.map((prefix) => {
115
93
  if (message?.content?.startsWith(prefix)) {
116
- command = message.content
117
- .replace(prefix, "")
118
- .split(/ +/)
119
- .shift();
94
+ command = message.content.replace(prefix, "").split(/ +/).shift();
120
95
  px = prefix;
121
96
  }
122
97
  });
123
98
  }
124
99
  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();
100
+ if (message.mentions.users.has(this.client.user?.id || "") || message.mentions.repliedUser?.id === this.client.user?.id) {
101
+ command = message?.content?.replace(`<@${this.client.user?.id}>`, "").trim().split(/ +/).shift();
132
102
  px = "MentionPrefix";
133
103
  }
134
104
  }
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")) {
105
+ const prefix = Array.isArray(this.client.handlerOptions.message?.prefix) ? this.client.handlerOptions.message?.prefix : [this.client.handlerOptions.message?.prefix];
106
+ if ((cmd.name.toLowerCase() == command?.toLowerCase() || cmd.aliases?.map((c) => c.toLowerCase())?.includes(command?.toLowerCase())) && (cmd.prefix.includes(px) || prefix?.includes(px) || px === "MentionPrefix")) {
145
107
  try {
108
+ message = message;
146
109
  const inhibitor = new InhibitorValidation(this.client, message, command);
147
110
  if (commandValidation(message, cmd, this.client))
148
111
  return;
149
112
  if (await inhibitor.inhibit())
150
113
  return;
151
- if (cmd.conditions && (await cmd.conditions(message)))
114
+ if (cmd.conditions && await cmd.conditions(message, await messageArguments(message, cmd)))
152
115
  return;
153
- await cmd.exec(message, await messageArgs(message, cmd));
116
+ await cmd.exec(message, await messageArguments(message, cmd));
154
117
  this.client.emit("commandRun", message, cmd);
155
118
  }
156
119
  catch (error) {
@@ -163,8 +126,9 @@ export class MessageCommandEvents {
163
126
  }
164
127
  messageDelete() {
165
128
  this.client.on("messageDelete", async (message) => {
166
- if (this.client.cache.messages.has(message.id) &&
167
- this.client.handlerOptions.message?.handleDeletes) {
129
+ if (this.client.cache.messages.has(message.id) && this.client.handlerOptions.message?.handleDeletes) {
130
+ if (this.client.handlerOptions.message?.handleTyping)
131
+ message.channel.sendTyping();
168
132
  try {
169
133
  const msg = this.client.cache.messages.get(message.id);
170
134
  const response = await message.channel.messages.fetch(msg?.response);
@@ -187,39 +151,20 @@ export class SlashCommandEvents {
187
151
  if (interaction.type === InteractionType.ApplicationCommand) {
188
152
  if (this.client.commands.slash.has(interaction.commandName)) {
189
153
  let command = this.client.commands.slash.get(interaction.commandName);
190
- const argumentsInfo = new CommandArguments(interaction);
154
+ const argumentsInfo = new InteractionArguments(interaction);
191
155
  try {
192
156
  const inhibitor = new InhibitorValidation(this.client, interaction, command);
193
157
  if (await inhibitor.inhibit())
194
158
  return;
195
159
  if (commandValidation(interaction, command, this.client))
196
160
  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
- })))
161
+ if (command.defer?.reply !== false && this.client.handlerOptions.slash?.defer?.reply)
162
+ await interaction.deferReply({ ephemeral: this.client.handlerOptions.slash?.defer?.ephemeral, fetchReply: this.client.handlerOptions.slash?.defer?.fetchReply, });
163
+ if (!(interaction.deferred || interaction.replied) && command.defer?.reply)
164
+ await interaction.deferReply({ ephemeral: command.defer?.ephemeral, fetchReply: command.defer?.fetchReply, });
165
+ if (command.conditions && (await command.conditions(interaction, { group: argumentsInfo.group(), subcommand: argumentsInfo.subcommand(), args: await argumentsInfo.arguments() })))
217
166
  return;
218
- await command.exec(interaction, {
219
- group: argumentsInfo.group(),
220
- subcommand: argumentsInfo.subcommand(),
221
- args: await argumentsInfo.arguments(),
222
- });
167
+ await command.exec(interaction, { group: argumentsInfo.group(), subcommand: argumentsInfo.subcommand(), args: await argumentsInfo.arguments(), });
223
168
  this.client.emit("commandRun", interaction, command);
224
169
  }
225
170
  catch (error) {
@@ -250,20 +195,10 @@ export class ContextCommandEvents {
250
195
  return;
251
196
  if (command.conditions && (await command.conditions(interaction)))
252
197
  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
- }
198
+ if (command.defer?.reply !== false && this.client.handlerOptions.context?.defer?.reply)
199
+ await interaction.deferReply({ ephemeral: this.client.handlerOptions.context?.defer?.ephemeral, fetchReply: this.client.handlerOptions.context?.defer?.fetchReply, });
200
+ if (!(interaction.deferred || interaction.replied) && command.defer?.reply)
201
+ await interaction.deferReply({ ephemeral: command.defer?.ephemeral, fetchReply: command.defer?.fetchReply, });
267
202
  await command.exec(interaction);
268
203
  this.client.emit("commandRun", interaction, command);
269
204
  }
@@ -282,47 +217,39 @@ export class CommandsDeploy {
282
217
  }
283
218
  deploy() {
284
219
  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
- }));
220
+ const slashCommands = [], contextCommands = [];
221
+ this.client.commands.context.map(command => command.data ? contextCommands.push(command.data.toJSON()) : null);
222
+ this.client.commands.slash.map(command => command.data ? slashCommands.push(command.data.toJSON()) : null);
296
223
  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
- });
224
+ const global = { slash: this.client.handlerOptions.slash?.global, context: this.client.handlerOptions.context?.global };
225
+ const guild = { slash: this.client.handlerOptions.slash?.guildId, context: this.client.handlerOptions.context?.guildId };
226
+ if (global.slash && global.context) {
227
+ if (guild.slash !== guild.context)
228
+ 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 }));
229
+ this.put("global", guild.slash, [...contextCommands, ...slashCommands]);
230
+ this.put("guild", guild.slash, []);
231
+ }
232
+ if (global.slash && !global.context) {
233
+ this.put("global", guild.slash, slashCommands);
307
234
  }
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
- });
235
+ if (!global.slash && global.context) {
236
+ this.put("global", guild.context, contextCommands);
315
237
  }
316
- if (this.client.handlerOptions.slash?.logging ||
317
- this.client.handlerOptions?.context?.logging)
318
- console.info(Style.log(`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"}.`, { color: Style.TextColor.Purple }));
238
+ if (!global.slash && !global.context) {
239
+ this.put("guild", guild.slash, [...contextCommands, ...slashCommands]);
240
+ }
241
+ console.log(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 }));
322
242
  }
323
243
  catch (error) {
324
244
  console.error(Style.log(`Xernerx | Couldn't deploy interaction commands because <${error}>.`, { color: Style.BackgroundColor.Red }));
325
245
  }
326
246
  });
327
247
  }
248
+ put(type, guild, body) {
249
+ const rest = new REST({ version: GatewayVersion }).setToken(this.client.token);
250
+ if (type === "guild")
251
+ rest.put(Routes.applicationGuildCommands(this.client.user?.id, guild), { body });
252
+ else
253
+ rest.put(Routes.applicationCommands(this.client.user?.id), { body });
254
+ }
328
255
  }
@@ -1,6 +1,6 @@
1
- import { XernerxClient } from "../main.js";
1
+ import { ExtensionBuilder, XernerxClient } from "../main.js";
2
2
  export default class Extensions {
3
3
  client: XernerxClient;
4
4
  constructor(client: XernerxClient);
5
- load(extensions: Array<any>, logging?: boolean): Promise<void>;
5
+ load(extensions: Array<ExtensionBuilder>, logging?: boolean): Promise<void>;
6
6
  }
@@ -1,17 +1,12 @@
1
- import { Interaction, Message } from "discord.js";
2
- import { MessageCommandOptions, SlashCommandOptions, ContextCommandOptions } from "../interfaces/CommandInterfaces.js";
3
- import { InhibitorType } from "../types/InhibitorTypes.js";
1
+ import { InhibitorType } from "../types/enums.js";
4
2
  import XernerxClient from "../client/XernerxClient.js";
3
+ import { XernerxInteraction, XernerxMessage } from "../types/types.js";
5
4
  export declare class InhibitorValidation {
6
5
  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;
6
+ action: XernerxMessage | XernerxInteraction;
7
+ command: string;
8
+ inhibited: Record<string, string | void>;
9
+ constructor(client: XernerxClient, action: XernerxMessage | XernerxInteraction, command: string);
10
+ inhibit(): Promise<Record<string, string | void> | undefined>;
11
+ args(action: XernerxInteraction | XernerxMessage | any, type: InhibitorType): any;
17
12
  }
@@ -1,4 +1,4 @@
1
- import { InhibitorType } from "../types/InhibitorTypes.js";
1
+ import { InhibitorType } from "../types/enums.js";
2
2
  export class InhibitorValidation {
3
3
  client;
4
4
  action;
@@ -1,28 +1,32 @@
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"
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;
11
6
  }
12
- export declare enum ContextCommandType {
13
- Message = 3,
14
- User = 2
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
+ };
15
20
  }
16
- export declare enum EventEmitterType {
17
- Client = "client",
18
- Rest = "rest",
19
- Process = "process"
21
+ export interface XernerxUser extends User {
22
+ isOwner: boolean;
20
23
  }
21
- export type SlashCommandOptionChoices = SlashCommandStringOption | SlashCommandNumberOption | SlashCommandIntegerOption;
22
- export type SlashCommandOption = SlashCommandOptionChoices | SlashCommandBooleanOption | SlashCommandUserOption | SlashCommandChannelOption | SlashCommandRoleOption | SlashCommandMentionableOption;
23
- export type SlashArgumentTypes = "String" | "Number" | "Boolean" | "User" | "Channel" | "Role" | "Mentionable" | "Integer";
24
- declare const _default: {
25
- CommandType: typeof CommandType;
26
- EventEmitterType: typeof EventEmitterType;
27
- };
28
- export default _default;
24
+ export interface XernerxRole extends Role {
25
+ }
26
+ export interface XernerxTextChannel extends TextChannel {
27
+ }
28
+ export interface XernerxGuild extends Guild {
29
+ }
30
+ export interface XernerxMember extends GuildMember {
31
+ }
32
+ export type MessageCommandArgsTypes = "flag" | "string" | "number" | "channel" | "user" | "member" | "boolean" | "role";
@@ -1,26 +1 @@
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 ContextCommandType;
13
- (function (ContextCommandType) {
14
- ContextCommandType[ContextCommandType["Message"] = 3] = "Message";
15
- ContextCommandType[ContextCommandType["User"] = 2] = "User";
16
- })(ContextCommandType = ContextCommandType || (ContextCommandType = {}));
17
- export var EventEmitterType;
18
- (function (EventEmitterType) {
19
- EventEmitterType["Client"] = "client";
20
- EventEmitterType["Rest"] = "rest";
21
- EventEmitterType["Process"] = "process";
22
- })(EventEmitterType = EventEmitterType || (EventEmitterType = {}));
23
- export default {
24
- CommandType,
25
- EventEmitterType,
26
- };
1
+ export {};
@@ -0,0 +1,35 @@
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";
@@ -0,0 +1,35 @@
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 = {}));
@@ -0,0 +1,25 @@
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
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,18 @@
1
+ import { TextChannel, Message, User, Guild, GuildMember } 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 Message {
8
+ util: InteractionCommandUtil;
9
+ }
10
+ export interface XernerxUser extends User {
11
+ isOwner: boolean;
12
+ }
13
+ export interface XernerxTextChannel extends TextChannel {
14
+ }
15
+ export interface XernerxGuild extends Guild {
16
+ }
17
+ export interface XernerxMember extends GuildMember {
18
+ }
@@ -0,0 +1 @@
1
+ export {};