xernerx 3.2.6 → 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 +1 -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 +2 -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 +61 -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";
@@ -19,63 +19,42 @@ export class MessageCommandEvents {
19
19
  message.util = new MessageCommandUtil(this.client, message);
20
20
  const commands = this.client.commands.message;
21
21
  commands
22
- .filter((c) => !c.regex)
22
+ .filter(c => !c.regex)
23
23
  .map(async (cmd) => {
24
24
  if (cmd.prefix) {
25
- cmd.prefix.map((prefix) => {
25
+ cmd.prefix.map(prefix => {
26
26
  if (message.content.startsWith(prefix)) {
27
- command = message.content
28
- .replace(prefix, "")
29
- .split(/ +/)
30
- .shift();
27
+ command = message.content.replace(prefix, "").split(/ +/).shift();
31
28
  px = prefix;
32
29
  }
33
30
  });
34
31
  }
35
32
  if (this.client.handlerOptions.message?.prefix) {
36
- const prefix = Array.isArray(this.client.handlerOptions.message.prefix)
37
- ? this.client.handlerOptions.message.prefix
38
- : [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];
39
34
  prefix.map((prefix) => {
40
35
  if (message.content.startsWith(prefix)) {
41
- command = message.content
42
- .replace(prefix, "")
43
- .split(/ +/)
44
- .shift();
36
+ command = message.content.replace(prefix, "").split(/ +/).shift();
45
37
  px = prefix;
46
38
  }
47
39
  });
48
40
  }
49
41
  if (this.client.handlerOptions.message?.allowMention) {
50
- if (message.mentions.users.has(this.client.user?.id || "") ||
51
- message.mentions.repliedUser?.id === this.client.user?.id) {
52
- command = message.content
53
- .replace(`<@${this.client.user?.id}>`, "")
54
- .trim()
55
- .split(/ +/)
56
- .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();
57
44
  px = "MentionPrefix";
58
45
  }
59
46
  }
60
- const prefix = Array.isArray(this.client.handlerOptions.message?.prefix)
61
- ? this.client.handlerOptions.message?.prefix
62
- : [this.client.handlerOptions.message?.prefix];
63
- if ((cmd.name.toLowerCase() == command?.toLowerCase() ||
64
- cmd.aliases
65
- ?.map((c) => c.toLowerCase())
66
- ?.includes(command?.toLowerCase())) &&
67
- (cmd.prefix.includes(px) ||
68
- prefix?.includes(px) ||
69
- 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")) {
70
49
  try {
71
50
  const inhibitor = new InhibitorValidation(this.client, message, command);
72
51
  if (commandValidation(message, cmd, this.client))
73
52
  return;
74
53
  if (await inhibitor.inhibit())
75
54
  return;
76
- if (cmd.conditions && (await cmd.conditions(message)))
55
+ if (cmd.conditions && await cmd.conditions(message, await messageArguments(message, cmd)))
77
56
  return;
78
- await cmd.exec(message, await messageArgs(message, cmd));
57
+ await cmd.exec(message, await messageArguments(message, cmd));
79
58
  this.client.emit("commandRun", message, cmd);
80
59
  }
81
60
  catch (error) {
@@ -88,7 +67,7 @@ export class MessageCommandEvents {
88
67
  }
89
68
  messageUpdate() {
90
69
  this.client.on("messageUpdate", async (old, message) => {
91
- message = message; // could just do this
70
+ message = message;
92
71
  if (!message.author?.bot) {
93
72
  let command = undefined, px = undefined;
94
73
  if (this.client.handlerOptions.message?.handleTyping)
@@ -103,58 +82,38 @@ export class MessageCommandEvents {
103
82
  if (cmd.prefix) {
104
83
  cmd.prefix.map((prefix) => {
105
84
  if (message?.content?.startsWith(prefix)) {
106
- command = message.content
107
- .replace(prefix, "")
108
- .split(/ +/)
109
- .shift();
85
+ command = message.content.replace(prefix, "").split(/ +/).shift();
110
86
  px = prefix;
111
87
  }
112
88
  });
113
89
  }
114
90
  if (this.client.handlerOptions.message?.prefix) {
115
- const prefix = Array.isArray(this.client.handlerOptions.message.prefix)
116
- ? this.client.handlerOptions.message.prefix
117
- : [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];
118
92
  prefix.map((prefix) => {
119
93
  if (message?.content?.startsWith(prefix)) {
120
- command = message.content
121
- .replace(prefix, "")
122
- .split(/ +/)
123
- .shift();
94
+ command = message.content.replace(prefix, "").split(/ +/).shift();
124
95
  px = prefix;
125
96
  }
126
97
  });
127
98
  }
128
99
  if (this.client.handlerOptions.message?.allowMention) {
129
- if (message.mentions.users.has(this.client.user?.id || "") ||
130
- message.mentions.repliedUser?.id === this.client.user?.id) {
131
- command = message?.content
132
- ?.replace(`<@${this.client.user?.id}>`, "")
133
- .trim()
134
- .split(/ +/)
135
- .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();
136
102
  px = "MentionPrefix";
137
103
  }
138
104
  }
139
- const prefix = Array.isArray(this.client.handlerOptions.message?.prefix)
140
- ? this.client.handlerOptions.message?.prefix
141
- : [this.client.handlerOptions.message?.prefix];
142
- if ((cmd.name.toLowerCase() == command?.toLowerCase() ||
143
- cmd.aliases
144
- ?.map((c) => c.toLowerCase())
145
- ?.includes(command?.toLowerCase())) &&
146
- (cmd.prefix.includes(px) ||
147
- prefix?.includes(px) ||
148
- 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")) {
149
107
  try {
108
+ message = message;
150
109
  const inhibitor = new InhibitorValidation(this.client, message, command);
151
110
  if (commandValidation(message, cmd, this.client))
152
111
  return;
153
112
  if (await inhibitor.inhibit())
154
113
  return;
155
- if (cmd.conditions && (await cmd.conditions(message)))
114
+ if (cmd.conditions && await cmd.conditions(message, await messageArguments(message, cmd)))
156
115
  return;
157
- await cmd.exec(message, await messageArgs(message, cmd));
116
+ await cmd.exec(message, await messageArguments(message, cmd));
158
117
  this.client.emit("commandRun", message, cmd);
159
118
  }
160
119
  catch (error) {
@@ -167,8 +126,7 @@ export class MessageCommandEvents {
167
126
  }
168
127
  messageDelete() {
169
128
  this.client.on("messageDelete", async (message) => {
170
- if (this.client.cache.messages.has(message.id) &&
171
- this.client.handlerOptions.message?.handleDeletes) {
129
+ if (this.client.cache.messages.has(message.id) && this.client.handlerOptions.message?.handleDeletes) {
172
130
  if (this.client.handlerOptions.message?.handleTyping)
173
131
  message.channel.sendTyping();
174
132
  try {
@@ -193,39 +151,20 @@ export class SlashCommandEvents {
193
151
  if (interaction.type === InteractionType.ApplicationCommand) {
194
152
  if (this.client.commands.slash.has(interaction.commandName)) {
195
153
  let command = this.client.commands.slash.get(interaction.commandName);
196
- const argumentsInfo = new CommandArguments(interaction);
154
+ const argumentsInfo = new InteractionArguments(interaction);
197
155
  try {
198
156
  const inhibitor = new InhibitorValidation(this.client, interaction, command);
199
157
  if (await inhibitor.inhibit())
200
158
  return;
201
159
  if (commandValidation(interaction, command, this.client))
202
160
  return;
203
- if (command.defer?.reply !== false &&
204
- this.client.handlerOptions.slash?.defer?.reply) {
205
- await interaction.deferReply({
206
- ephemeral: this.client.handlerOptions.slash?.defer?.ephemeral,
207
- fetchReply: this.client.handlerOptions.slash?.defer?.fetchReply,
208
- });
209
- }
210
- if (!(interaction.deferred || interaction.replied) &&
211
- command.defer?.reply) {
212
- await interaction.deferReply({
213
- ephemeral: command.defer?.ephemeral,
214
- fetchReply: command.defer?.fetchReply,
215
- });
216
- }
217
- if (command.conditions &&
218
- (await command.conditions(interaction, {
219
- group: argumentsInfo.group(),
220
- subcommand: argumentsInfo.subcommand(),
221
- args: await argumentsInfo.arguments(),
222
- })))
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() })))
223
166
  return;
224
- await command.exec(interaction, {
225
- group: argumentsInfo.group(),
226
- subcommand: argumentsInfo.subcommand(),
227
- args: await argumentsInfo.arguments(),
228
- });
167
+ await command.exec(interaction, { group: argumentsInfo.group(), subcommand: argumentsInfo.subcommand(), args: await argumentsInfo.arguments(), });
229
168
  this.client.emit("commandRun", interaction, command);
230
169
  }
231
170
  catch (error) {
@@ -256,20 +195,10 @@ export class ContextCommandEvents {
256
195
  return;
257
196
  if (command.conditions && (await command.conditions(interaction)))
258
197
  return;
259
- if (command.defer?.reply !== false &&
260
- this.client.handlerOptions.context?.defer?.reply) {
261
- await interaction.deferReply({
262
- ephemeral: this.client.handlerOptions.context?.defer?.ephemeral,
263
- fetchReply: this.client.handlerOptions.context?.defer?.fetchReply,
264
- });
265
- }
266
- if (!(interaction.deferred || interaction.replied) &&
267
- command.defer?.reply) {
268
- await interaction.deferReply({
269
- ephemeral: command.defer?.ephemeral,
270
- fetchReply: command.defer?.fetchReply,
271
- });
272
- }
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, });
273
202
  await command.exec(interaction);
274
203
  this.client.emit("commandRun", interaction, command);
275
204
  }
@@ -288,47 +217,39 @@ export class CommandsDeploy {
288
217
  }
289
218
  deploy() {
290
219
  this.client.once("ready", async (client) => {
291
- const rest = new REST({ version: GatewayVersion }).setToken(client.token);
292
- const commands = [
293
- ...this.client.commands.context,
294
- ...this.client.commands.slash,
295
- ];
296
- const deployableCommands = [];
297
- commands.map((commands) => commands.map((command) => {
298
- if (command?.data) {
299
- deployableCommands.push(command.data.toJSON());
300
- }
301
- }));
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);
302
223
  try {
303
- if (this.client.handlerOptions.context?.global === true ||
304
- this.client.handlerOptions.slash?.global === true) {
305
- rest.put(Routes.applicationCommands(client.user.id), {
306
- body: deployableCommands,
307
- });
308
- rest.put(Routes.applicationGuildCommands(client.user.id, this.client.handlerOptions.slash?.guildId ||
309
- this.client.handlerOptions.context?.guildId ||
310
- ""), {
311
- body: [],
312
- });
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);
313
234
  }
314
- if (this.client.handlerOptions.context?.global === false ||
315
- this.client.handlerOptions.slash?.global === false) {
316
- rest.put(Routes.applicationGuildCommands(client.user.id, this.client.handlerOptions.slash?.guildId ||
317
- this.client.handlerOptions.context?.guildId ||
318
- ""), {
319
- body: deployableCommands,
320
- });
235
+ if (!global.slash && global.context) {
236
+ this.put("global", guild.context, contextCommands);
321
237
  }
322
- if (this.client.handlerOptions.slash?.logging ||
323
- this.client.handlerOptions?.context?.logging)
324
- console.info(Style.log(`Xernerx | Deployed ${deployableCommands.length} of ${commands.length} interaction commands ${this.client.handlerOptions.slash?.global ||
325
- this.client.handlerOptions.context?.global
326
- ? `globally in ${(await this.client.guilds.fetch()).size} server(s), deleted local commands.`
327
- : "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 }));
328
242
  }
329
243
  catch (error) {
330
244
  console.error(Style.log(`Xernerx | Couldn't deploy interaction commands because <${error}>.`, { color: Style.BackgroundColor.Red }));
331
245
  }
332
246
  });
333
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
+ }
334
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 {};