xernerx 4.5.23 → 4.5.26

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 (70) hide show
  1. package/README.md +3 -0
  2. package/dist/build/XernerxContextCommand.d.ts +42 -50
  3. package/dist/build/XernerxContextCommand.js +71 -71
  4. package/dist/build/XernerxEvent.d.ts +15 -15
  5. package/dist/build/XernerxEvent.js +22 -22
  6. package/dist/build/XernerxInhibitor.d.ts +14 -25
  7. package/dist/build/XernerxInhibitor.js +20 -20
  8. package/dist/build/XernerxMessageCommand.d.ts +47 -53
  9. package/dist/build/XernerxMessageCommand.js +70 -70
  10. package/dist/build/XernerxSlashCommand.d.ts +57 -71
  11. package/dist/build/XernerxSlashCommand.js +128 -128
  12. package/dist/client/XernerxClient.d.ts +40 -48
  13. package/dist/client/XernerxClient.js +77 -77
  14. package/dist/client/XernerxShardClient.d.ts +12 -12
  15. package/dist/client/XernerxShardClient.js +39 -47
  16. package/dist/functions/deploy.d.ts +1 -1
  17. package/dist/functions/deploy.js +36 -31
  18. package/dist/functions/load.d.ts +1 -1
  19. package/dist/functions/load.js +29 -28
  20. package/dist/functions/reload.d.ts +1 -1
  21. package/dist/functions/reload.js +38 -35
  22. package/dist/functions/sendWebhook.d.ts +1 -1
  23. package/dist/functions/sendWebhook.js +12 -11
  24. package/dist/functions/setPresence.d.ts +2 -2
  25. package/dist/functions/setPresence.js +17 -18
  26. package/dist/functions/xernerxUser.d.ts +1 -1
  27. package/dist/functions/xernerxUser.js +6 -6
  28. package/dist/handlers/CommandHandler.d.ts +9 -9
  29. package/dist/handlers/CommandHandler.d.ts.map +1 -1
  30. package/dist/handlers/CommandHandler.js +281 -249
  31. package/dist/handlers/CommandHandler.js.map +1 -1
  32. package/dist/handlers/EventHandler.d.ts +3 -3
  33. package/dist/handlers/EventHandler.js +19 -19
  34. package/dist/handlers/ExtensionHandler.d.ts +3 -3
  35. package/dist/handlers/ExtensionHandler.js +20 -18
  36. package/dist/handlers/Handler.d.ts +8 -8
  37. package/dist/handlers/Handler.js +42 -32
  38. package/dist/handlers/InhibitorHandler.d.ts +3 -3
  39. package/dist/handlers/InhibitorHandler.js +19 -19
  40. package/dist/handlers/WebhookHandler.d.ts +6 -4
  41. package/dist/handlers/WebhookHandler.js +44 -47
  42. package/dist/main.d.ts +22 -29
  43. package/dist/main.js +22 -29
  44. package/dist/models/Arguments.d.ts +2 -5
  45. package/dist/models/Arguments.js +150 -135
  46. package/dist/tools/XernerxError.d.ts +5 -5
  47. package/dist/tools/XernerxError.js +9 -9
  48. package/dist/tools/XernerxLog.d.ts +13 -13
  49. package/dist/tools/XernerxLog.js +69 -74
  50. package/dist/tools/XernerxText.d.ts +23 -23
  51. package/dist/tools/XernerxText.js +85 -76
  52. package/dist/types/extenders.d.ts +36 -44
  53. package/dist/types/extenders.js +1 -1
  54. package/dist/types/interfaces.d.ts +182 -185
  55. package/dist/types/interfaces.js +1 -1
  56. package/dist/types/types.d.ts +7 -179
  57. package/dist/types/types.js +1 -1
  58. package/dist/utils/ClientUtil.d.ts +9 -11
  59. package/dist/utils/ClientUtil.js +73 -57
  60. package/dist/utils/InteractionUtil.d.ts +7 -7
  61. package/dist/utils/InteractionUtil.js +98 -96
  62. package/dist/utils/MessageUtil.d.ts +11 -11
  63. package/dist/utils/MessageUtil.js +135 -130
  64. package/dist/utils/Util.d.ts +5 -5
  65. package/dist/utils/Util.js +8 -8
  66. package/dist/validators/commandValidation.d.ts +2 -5
  67. package/dist/validators/commandValidation.js +53 -43
  68. package/dist/validators/inhibitorValidations.d.ts +3 -19
  69. package/dist/validators/inhibitorValidations.js +31 -31
  70. package/package.json +16 -13
@@ -2,74 +2,74 @@
2
2
  import { z } from 'zod';
3
3
  import { XernerxLog } from '../main.js';
4
4
  export default class XernerxMessageCommand {
5
- constructor(id, options) {
6
- this.id = id;
7
- this.regex = options.regex;
8
- this.args = options.args;
9
- this.flags = options.flags;
10
- options = z
11
- .object({
12
- name: z.string(),
13
- aliases: z.array(z.string()).default([]),
14
- description: z.string().or(z.null()).default(null),
15
- usage: z.string().or(z.null()).default(null),
16
- info: z.string().or(z.null()).default(null),
17
- category: z.string().or(z.null()).default(null),
18
- cooldown: z.number().or(z.null()).default(null),
19
- prefix: z.array(z.string()).or(z.string()).default([]),
20
- ignore: z
21
- .object({
22
- owner: z.boolean().default(false),
23
- users: z.array(z.string()).default([]),
24
- channels: z.array(z.string()).default([]),
25
- guilds: z.array(z.string()).default([]),
26
- })
27
- .default({}),
28
- strict: z
29
- .object({
30
- owner: z.boolean().default(false),
31
- users: z.array(z.string()).default([]),
32
- channels: z.array(z.string()).default([]),
33
- guilds: z.array(z.string()).default([]),
34
- })
35
- .default({}),
36
- permissions: z
37
- .object({
38
- user: z.array(z.string()).default([]),
39
- client: z.array(z.string()).default([]),
40
- dm: z.boolean().default(true),
41
- })
42
- .default({}),
43
- })
44
- .parse(options);
45
- this.name = options.name;
46
- this.aliases = options.aliases;
47
- this.prefix = options.prefix;
48
- this.description = options.description;
49
- this.usage = options.usage;
50
- this.info = options.info;
51
- this.category = options.category;
52
- this.cooldown = options.cooldown;
53
- this.ignore = options.ignore;
54
- this.strict = options.strict;
55
- this.separator = options.separator;
56
- this.permissions = options.permissions;
57
- this.client = this.client;
58
- }
59
- /**
60
- * @description Checks for conditions before running the command
61
- * @param message - The message event emitted on this command
62
- * @param options - The args and flags parsed on this command
63
- */
64
- async conditions(message, { args, flags }) {}
65
- /**
66
- * @description Runs the execution rule
67
- * @param message - The message event emitted on this command
68
- * @param options - The args and flags parsed on this command
69
- */
70
- async exec(message, { args, flags }) {
71
- new XernerxLog(this.client).error(`${this.id} doesn't have an execution rule.`);
72
- return await this.client.emit('commandError', message, `${this.id} doesn't have an execution rule.`, this, this.filetype);
73
- }
5
+ constructor(id, options) {
6
+ this.id = id;
7
+ this.regex = options.regex;
8
+ this.args = options.args;
9
+ this.flags = options.flags;
10
+ options = z
11
+ .object({
12
+ name: z.string(),
13
+ aliases: z.array(z.string()).default([]),
14
+ description: z.string().or(z.null()).default(null),
15
+ usage: z.string().or(z.null()).default(null),
16
+ info: z.string().or(z.null()).default(null),
17
+ category: z.string().or(z.null()).default(null),
18
+ cooldown: z.number().or(z.null()).default(null),
19
+ prefix: z.array(z.string()).or(z.string()).default([]),
20
+ ignore: z
21
+ .object({
22
+ owner: z.boolean().default(false),
23
+ users: z.array(z.string()).default([]),
24
+ channels: z.array(z.string()).default([]),
25
+ guilds: z.array(z.string()).default([]),
26
+ })
27
+ .default({}),
28
+ strict: z
29
+ .object({
30
+ owner: z.boolean().default(false),
31
+ users: z.array(z.string()).default([]),
32
+ channels: z.array(z.string()).default([]),
33
+ guilds: z.array(z.string()).default([]),
34
+ })
35
+ .default({}),
36
+ permissions: z
37
+ .object({
38
+ user: z.array(z.string()).default([]),
39
+ client: z.array(z.string()).default([]),
40
+ dm: z.boolean().default(true),
41
+ })
42
+ .default({}),
43
+ })
44
+ .parse(options);
45
+ this.name = options.name;
46
+ this.aliases = options.aliases;
47
+ this.prefix = options.prefix;
48
+ this.description = options.description;
49
+ this.usage = options.usage;
50
+ this.info = options.info;
51
+ this.category = options.category;
52
+ this.cooldown = options.cooldown;
53
+ this.ignore = options.ignore;
54
+ this.strict = options.strict;
55
+ this.separator = options.separator;
56
+ this.permissions = options.permissions;
57
+ this.client = this.client;
58
+ }
59
+ /**
60
+ * @description Checks for conditions before running the command
61
+ * @param message - The message event emitted on this command
62
+ * @param options - The args and flags parsed on this command
63
+ */
64
+ async conditions(message, { args, flags }) { }
65
+ /**
66
+ * @description Runs the execution rule
67
+ * @param message - The message event emitted on this command
68
+ * @param options - The args and flags parsed on this command
69
+ */
70
+ async exec(message, { args, flags }) {
71
+ new XernerxLog(this.client).error(`${this.id} doesn't have an execution rule.`);
72
+ return await this.client.emit('commandError', message, `${this.id} doesn't have an execution rule.`, this, this.filetype);
73
+ }
74
74
  }
75
- //# sourceMappingURL=XernerxMessageCommand.js.map
75
+ //# sourceMappingURL=XernerxMessageCommand.js.map
@@ -4,75 +4,61 @@ import { XernerxClientType, XernerxMessageContextInteraction, XernerxSlashIntera
4
4
  import { SlashCommandArguments, SlashCommandOptions } from '../types/interfaces.js';
5
5
  import { XernerxInteraction } from '../types/types.js';
6
6
  export default class XernerxSlashCommand {
7
- readonly id: string;
8
- readonly data: Discord.SlashCommandBuilder;
9
- readonly name: string;
10
- readonly description: string;
11
- readonly usage: string | null | undefined;
12
- readonly info: string | null | undefined;
13
- readonly category: string | null | undefined;
14
- readonly cooldown: number | null | undefined;
15
- readonly ignore:
16
- | {
17
- owner?: boolean | undefined;
18
- users?: string[] | undefined;
19
- channels?: string[] | undefined;
20
- guilds?: string[] | undefined;
21
- }
22
- | undefined;
23
- readonly strict:
24
- | {
25
- owner?: boolean | undefined;
26
- users?: string[] | undefined;
27
- channels?: string[] | undefined;
28
- guilds?: string[] | undefined;
29
- }
30
- | undefined;
31
- readonly permissions:
32
- | {
33
- user?: string[] | import('../main.js').PermissionNames[] | undefined;
34
- client?: string[] | import('../main.js').PermissionNames[] | undefined;
35
- dm?: boolean | undefined;
36
- }
37
- | undefined;
38
- readonly defer:
39
- | {
40
- reply?: boolean | undefined;
41
- ephemeral?: boolean | undefined;
42
- fetchReply?: boolean | undefined;
43
- }
44
- | undefined;
45
- readonly filetype: 'SlashCommand';
46
- readonly filepath: string;
47
- readonly client: XernerxClientType;
48
- constructor(id: string, options: SlashCommandOptions);
49
- /**
50
- * @description autocomplete let's you add choices to string option arguments
51
- * @param interaction - The interaction event emitted on this command
52
- * @param focused - The command option that is in focus
53
- * @param options - The full list of options on the command
54
- */
55
- autocomplete<T>(interaction: XernerxInteraction<XernerxSlashInteraction | XernerxUserContextInteraction | XernerxMessageContextInteraction>, focused: T, options: T[]): Promise<void | any | T>;
56
- /**
57
- * @description Checks for conditions before running the command
58
- * @param interaction - The interaction event emitted on this command
59
- * @param options - The args, group and subcommand parsed on this command
60
- */
61
- conditions<T>(
62
- interaction: XernerxInteraction<XernerxSlashInteraction | XernerxUserContextInteraction | XernerxMessageContextInteraction>,
63
- { args, subcommand, group }: SlashCommandArguments
64
- ): Promise<void | any | T>;
65
- /**
66
- * @description Runs the execution rule
67
- * @param interaction - The interaction event emitted on this command
68
- * @param options - The args, group and subcommand parsed on this command
69
- */
70
- exec<T>(
71
- interaction: XernerxInteraction<XernerxSlashInteraction | XernerxUserContextInteraction | XernerxMessageContextInteraction>,
72
- { args, subcommand, group }: SlashCommandArguments
73
- ): Promise<void | any | T>;
74
- private addArguments;
75
- private addSubcommands;
76
- private addSubcommandGroups;
7
+ readonly id: string;
8
+ readonly data: Discord.SlashCommandBuilder;
9
+ readonly name: string;
10
+ readonly description: string;
11
+ readonly usage: string | null | undefined;
12
+ readonly info: string | null | undefined;
13
+ readonly category: string | null | undefined;
14
+ readonly cooldown: number | null | undefined;
15
+ readonly ignore: {
16
+ owner?: boolean | undefined;
17
+ users?: string[] | undefined;
18
+ channels?: string[] | undefined;
19
+ guilds?: string[] | undefined;
20
+ } | undefined;
21
+ readonly strict: {
22
+ owner?: boolean | undefined;
23
+ users?: string[] | undefined;
24
+ channels?: string[] | undefined;
25
+ guilds?: string[] | undefined;
26
+ } | undefined;
27
+ readonly permissions: {
28
+ user?: string[] | import("../main.js").PermissionNames[] | undefined;
29
+ client?: string[] | import("../main.js").PermissionNames[] | undefined;
30
+ dm?: boolean | undefined;
31
+ } | undefined;
32
+ readonly defer: {
33
+ reply?: boolean | undefined;
34
+ ephemeral?: boolean | undefined;
35
+ fetchReply?: boolean | undefined;
36
+ } | undefined;
37
+ readonly filetype: 'SlashCommand';
38
+ readonly filepath: string;
39
+ readonly client: XernerxClientType;
40
+ constructor(id: string, options: SlashCommandOptions);
41
+ /**
42
+ * @description autocomplete let's you add choices to string option arguments
43
+ * @param interaction - The interaction event emitted on this command
44
+ * @param focused - The command option that is in focus
45
+ * @param options - The full list of options on the command
46
+ */
47
+ autocomplete<T>(interaction: XernerxInteraction<XernerxSlashInteraction | XernerxUserContextInteraction | XernerxMessageContextInteraction>, focused: T, options: T[]): Promise<void | any | T>;
48
+ /**
49
+ * @description Checks for conditions before running the command
50
+ * @param interaction - The interaction event emitted on this command
51
+ * @param options - The args, group and subcommand parsed on this command
52
+ */
53
+ conditions<T>(interaction: XernerxInteraction<XernerxSlashInteraction | XernerxUserContextInteraction | XernerxMessageContextInteraction>, { args, subcommand, group }: SlashCommandArguments): Promise<void | any | T>;
54
+ /**
55
+ * @description Runs the execution rule
56
+ * @param interaction - The interaction event emitted on this command
57
+ * @param options - The args, group and subcommand parsed on this command
58
+ */
59
+ exec<T>(interaction: XernerxInteraction<XernerxSlashInteraction | XernerxUserContextInteraction | XernerxMessageContextInteraction>, { args, subcommand, group }: SlashCommandArguments): Promise<void | any | T>;
60
+ private addArguments;
61
+ private addSubcommands;
62
+ private addSubcommandGroups;
77
63
  }
78
- //# sourceMappingURL=XernerxSlashCommand.d.ts.map
64
+ //# sourceMappingURL=XernerxSlashCommand.d.ts.map
@@ -3,132 +3,132 @@ import Discord, { SlashCommandSubcommandBuilder, SlashCommandSubcommandGroupBuil
3
3
  import { z } from 'zod';
4
4
  import { XernerxLog } from '../main.js';
5
5
  export default class XernerxSlashCommand {
6
- constructor(id, options) {
7
- this.id = id;
8
- this.data = new Discord.SlashCommandBuilder();
9
- this.data.setName(options.name);
10
- this.data.setNameLocalizations(options.nameLocalizations || null);
11
- this.data.setDescription(options.description);
12
- this.data.setDescriptionLocalizations(options.descriptionLocalizations || null);
13
- this.data.setDMPermission(options.permissions?.dm || null);
14
- if (options.args && options?.args?.length > 0) {
15
- this.addArguments(this.data, options.args);
16
- }
17
- if (options.subcommands && options?.subcommands?.length > 0) {
18
- this.addSubcommands(this.data, options.subcommands);
19
- }
20
- if (options.groups && options?.groups?.length > 0) {
21
- this.addSubcommandGroups(options.groups);
22
- }
23
- options = z
24
- .object({
25
- name: z.string(),
26
- description: z.string(),
27
- usage: z.string().or(z.null()).default(null),
28
- info: z.string().or(z.null()).default(null),
29
- category: z.string().or(z.null()).default(null),
30
- number: z.number().or(z.null()).default(null),
31
- channelType: z.array(z.number()).or(z.null()).default(null),
32
- ignore: z
33
- .object({
34
- owner: z.boolean().default(false),
35
- users: z.array(z.string()).default([]),
36
- channels: z.array(z.string()).default([]),
37
- guilds: z.array(z.string()).default([]),
38
- })
39
- .default({}),
40
- strict: z
41
- .object({
42
- owner: z.boolean().default(false),
43
- users: z.array(z.string()).default([]),
44
- channels: z.array(z.string()).default([]),
45
- guilds: z.array(z.string()).default([]),
46
- })
47
- .default({}),
48
- permissions: z
49
- .object({
50
- user: z.array(z.string()).default([]),
51
- client: z.array(z.string()).default([]),
52
- dm: z.boolean().default(true),
53
- })
54
- .default({}),
55
- defer: z
56
- .object({
57
- reply: z.boolean().default(false),
58
- ephemeral: z.boolean().default(false),
59
- fetch: z.boolean().default(false),
60
- })
61
- .default({}),
62
- })
63
- .parse(options);
64
- this.name = options.name;
65
- this.description = options.description;
66
- this.usage = options.usage;
67
- this.info = options.info;
68
- this.category = options.category;
69
- this.cooldown = options.cooldown;
70
- this.ignore = options.ignore;
71
- this.strict = options.strict;
72
- this.permissions = options.permissions;
73
- this.defer = options.defer;
74
- this.client = this.client;
75
- }
76
- /**
77
- * @description autocomplete let's you add choices to string option arguments
78
- * @param interaction - The interaction event emitted on this command
79
- * @param focused - The command option that is in focus
80
- * @param options - The full list of options on the command
81
- */
82
- async autocomplete(interaction, focused, options) {}
83
- /**
84
- * @description Checks for conditions before running the command
85
- * @param interaction - The interaction event emitted on this command
86
- * @param options - The args, group and subcommand parsed on this command
87
- */
88
- async conditions(interaction, { args, subcommand, group }) {}
89
- /**
90
- * @description Runs the execution rule
91
- * @param interaction - The interaction event emitted on this command
92
- * @param options - The args, group and subcommand parsed on this command
93
- */
94
- async exec(interaction, { args, subcommand, group }) {
95
- new XernerxLog(this.client).error(`${this.id} doesn't have an execution rule.`);
96
- return await this.client.emit('commandError', interaction, `${this.id} doesn't have an execution rule.`, this, this.filetype);
97
- }
98
- addArguments(command, args) {
99
- for (const argument of args) {
100
- let slashCommandArgumentType = `${argument.type.charAt(0).toUpperCase()}${argument.type.slice(1).toLowerCase()}`;
101
- command[`add${slashCommandArgumentType}Option`]((option) => {
102
- option
103
- .setName(argument.name)
104
- .setDescription(argument.description)
105
- .setRequired(argument.required || false);
106
- if (slashCommandArgumentType === 'String') {
107
- if (argument.choices)
108
- option.setChoices(
109
- ...argument.choices.map((choices) => {
110
- return { name: Object.keys(choices).at(0), value: Object.values(choices).at(0) };
111
- })
112
- );
113
- option.setAutocomplete(argument.autocomplete || false);
114
- }
115
- return option;
116
- });
117
- }
118
- }
119
- addSubcommands(method, subcommands) {
120
- for (const subcommand of subcommands) {
121
- let sub = new SlashCommandSubcommandBuilder().setName(subcommand.name).setDescription(subcommand.description);
122
- if (subcommand.args && subcommand?.args?.length > 0) this.addArguments(sub, subcommand.args);
123
- method.addSubcommand(sub);
124
- }
125
- }
126
- addSubcommandGroups(groups) {
127
- for (const group of groups) {
128
- let subcommandGroup = new SlashCommandSubcommandGroupBuilder().setName(group.name).setDescription(group.description);
129
- if (group.subcommands?.length > 0) this.addSubcommands(subcommandGroup, group.subcommands);
130
- this.data.addSubcommandGroup(subcommandGroup);
131
- }
132
- }
6
+ constructor(id, options) {
7
+ this.id = id;
8
+ this.data = new Discord.SlashCommandBuilder();
9
+ this.data.setName(options.name);
10
+ this.data.setNameLocalizations(options.nameLocalizations || null);
11
+ this.data.setDescription(options.description);
12
+ this.data.setDescriptionLocalizations(options.descriptionLocalizations || null);
13
+ this.data.setDMPermission(options.permissions?.dm || null);
14
+ if (options.args && options?.args?.length > 0) {
15
+ this.addArguments(this.data, options.args);
16
+ }
17
+ if (options.subcommands && options?.subcommands?.length > 0) {
18
+ this.addSubcommands(this.data, options.subcommands);
19
+ }
20
+ if (options.groups && options?.groups?.length > 0) {
21
+ this.addSubcommandGroups(options.groups);
22
+ }
23
+ options = z
24
+ .object({
25
+ name: z.string(),
26
+ description: z.string(),
27
+ usage: z.string().or(z.null()).default(null),
28
+ info: z.string().or(z.null()).default(null),
29
+ category: z.string().or(z.null()).default(null),
30
+ number: z.number().or(z.null()).default(null),
31
+ channelType: z.array(z.number()).or(z.null()).default(null),
32
+ ignore: z
33
+ .object({
34
+ owner: z.boolean().default(false),
35
+ users: z.array(z.string()).default([]),
36
+ channels: z.array(z.string()).default([]),
37
+ guilds: z.array(z.string()).default([]),
38
+ })
39
+ .default({}),
40
+ strict: z
41
+ .object({
42
+ owner: z.boolean().default(false),
43
+ users: z.array(z.string()).default([]),
44
+ channels: z.array(z.string()).default([]),
45
+ guilds: z.array(z.string()).default([]),
46
+ })
47
+ .default({}),
48
+ permissions: z
49
+ .object({
50
+ user: z.array(z.string()).default([]),
51
+ client: z.array(z.string()).default([]),
52
+ dm: z.boolean().default(true),
53
+ })
54
+ .default({}),
55
+ defer: z
56
+ .object({
57
+ reply: z.boolean().default(false),
58
+ ephemeral: z.boolean().default(false),
59
+ fetch: z.boolean().default(false),
60
+ })
61
+ .default({}),
62
+ })
63
+ .parse(options);
64
+ this.name = options.name;
65
+ this.description = options.description;
66
+ this.usage = options.usage;
67
+ this.info = options.info;
68
+ this.category = options.category;
69
+ this.cooldown = options.cooldown;
70
+ this.ignore = options.ignore;
71
+ this.strict = options.strict;
72
+ this.permissions = options.permissions;
73
+ this.defer = options.defer;
74
+ this.client = this.client;
75
+ }
76
+ /**
77
+ * @description autocomplete let's you add choices to string option arguments
78
+ * @param interaction - The interaction event emitted on this command
79
+ * @param focused - The command option that is in focus
80
+ * @param options - The full list of options on the command
81
+ */
82
+ async autocomplete(interaction, focused, options) { }
83
+ /**
84
+ * @description Checks for conditions before running the command
85
+ * @param interaction - The interaction event emitted on this command
86
+ * @param options - The args, group and subcommand parsed on this command
87
+ */
88
+ async conditions(interaction, { args, subcommand, group }) { }
89
+ /**
90
+ * @description Runs the execution rule
91
+ * @param interaction - The interaction event emitted on this command
92
+ * @param options - The args, group and subcommand parsed on this command
93
+ */
94
+ async exec(interaction, { args, subcommand, group }) {
95
+ new XernerxLog(this.client).error(`${this.id} doesn't have an execution rule.`);
96
+ return await this.client.emit('commandError', interaction, `${this.id} doesn't have an execution rule.`, this, this.filetype);
97
+ }
98
+ addArguments(command, args) {
99
+ for (const argument of args) {
100
+ let slashCommandArgumentType = `${argument.type.charAt(0).toUpperCase()}${argument.type.slice(1).toLowerCase()}`;
101
+ command[`add${slashCommandArgumentType}Option`]((option) => {
102
+ option
103
+ .setName(argument.name)
104
+ .setDescription(argument.description)
105
+ .setRequired(argument.required || false);
106
+ if (slashCommandArgumentType === 'String') {
107
+ if (argument.choices)
108
+ option.setChoices(...argument.choices.map((choices) => {
109
+ return { name: Object.keys(choices).at(0), value: Object.values(choices).at(0) };
110
+ }));
111
+ option.setAutocomplete(argument.autocomplete || false);
112
+ }
113
+ return option;
114
+ });
115
+ }
116
+ }
117
+ addSubcommands(method, subcommands) {
118
+ for (const subcommand of subcommands) {
119
+ let sub = new SlashCommandSubcommandBuilder().setName(subcommand.name).setDescription(subcommand.description);
120
+ if (subcommand.args && subcommand?.args?.length > 0)
121
+ this.addArguments(sub, subcommand.args);
122
+ method.addSubcommand(sub);
123
+ }
124
+ }
125
+ addSubcommandGroups(groups) {
126
+ for (const group of groups) {
127
+ let subcommandGroup = new SlashCommandSubcommandGroupBuilder().setName(group.name).setDescription(group.description);
128
+ if (group.subcommands?.length > 0)
129
+ this.addSubcommands(subcommandGroup, group.subcommands);
130
+ this.data.addSubcommandGroup(subcommandGroup);
131
+ }
132
+ }
133
133
  }
134
- //# sourceMappingURL=XernerxSlashCommand.js.map
134
+ //# sourceMappingURL=XernerxSlashCommand.js.map
@@ -4,52 +4,44 @@ import { XernerxOptions, ModuleOptions, XernerxCommands, XernerxCache } from '..
4
4
  import ClientUtil from '../utils/ClientUtil.js';
5
5
  import { XernerxInhibitor, XernerxEvent } from '../main.js';
6
6
  export default class XernerxClient<T = unknown> extends Client {
7
- readonly settings: {
8
- ownerId: (string | string[]) & (string | string[] | undefined);
9
- local: string;
10
- global?: boolean | undefined;
11
- permissions?:
12
- | {
13
- client: string[];
14
- user: string[];
15
- dm: boolean;
16
- }
17
- | undefined;
18
- ignore?:
19
- | {
20
- owner: boolean;
21
- self: boolean;
22
- bots: boolean;
23
- system: boolean;
24
- users: string[];
25
- channels: string[];
26
- guilds: string[];
27
- }
28
- | undefined;
29
- log?:
30
- | {
31
- ready: boolean;
32
- error: boolean;
33
- info: boolean;
34
- table: string[] | null;
35
- }
36
- | undefined;
37
- cooldown?:
38
- | {
39
- command: number;
40
- cache: number;
41
- }
42
- | undefined;
43
- };
44
- readonly config: NonNullable<T> | null;
45
- readonly commands: XernerxCommands;
46
- readonly events: Collection<string, XernerxEvent>;
47
- readonly inhibitors: Collection<string, XernerxInhibitor>;
48
- readonly modules: ModuleOptions;
49
- readonly util: ClientUtil;
50
- readonly stats: Record<string, number>;
51
- readonly cache: XernerxCache;
52
- constructor(discordOptions: ClientOptions, xernerxOptions: XernerxOptions, config?: T);
53
- connect(token: string): Promise<string>;
7
+ readonly settings: {
8
+ ownerId: (string | string[]) & (string | string[] | undefined);
9
+ local: string;
10
+ global?: boolean | undefined;
11
+ permissions?: {
12
+ client: string[];
13
+ user: string[];
14
+ dm: boolean;
15
+ } | undefined;
16
+ ignore?: {
17
+ owner: boolean;
18
+ self: boolean;
19
+ bots: boolean;
20
+ system: boolean;
21
+ users: string[];
22
+ channels: string[];
23
+ guilds: string[];
24
+ } | undefined;
25
+ log?: {
26
+ ready: boolean;
27
+ error: boolean;
28
+ info: boolean;
29
+ table: string[] | null;
30
+ } | undefined;
31
+ cooldown?: {
32
+ command: number;
33
+ cache: number;
34
+ } | undefined;
35
+ };
36
+ readonly config: NonNullable<T> | null;
37
+ readonly commands: XernerxCommands;
38
+ readonly events: Collection<string, XernerxEvent>;
39
+ readonly inhibitors: Collection<string, XernerxInhibitor>;
40
+ readonly modules: ModuleOptions;
41
+ readonly util: ClientUtil;
42
+ readonly stats: Record<string, number>;
43
+ readonly cache: XernerxCache;
44
+ constructor(discordOptions: ClientOptions, xernerxOptions: XernerxOptions, config?: T);
45
+ connect(token: string): Promise<string>;
54
46
  }
55
- //# sourceMappingURL=XernerxClient.d.ts.map
47
+ //# sourceMappingURL=XernerxClient.d.ts.map