xernerx 3.6.0 → 4.0.1

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 (201) hide show
  1. package/dist/build/ContextCommandBuilder.d.ts +47 -0
  2. package/dist/build/ContextCommandBuilder.js +78 -0
  3. package/dist/{cjs/build → build}/EventBuilder.d.ts +7 -6
  4. package/dist/build/EventBuilder.js +35 -0
  5. package/dist/build/InhibitorBuilder.d.ts +17 -0
  6. package/dist/build/InhibitorBuilder.js +26 -0
  7. package/dist/build/MessageCommandBuilder.d.ts +43 -0
  8. package/dist/build/MessageCommandBuilder.js +71 -0
  9. package/dist/{cjs/build → build}/SlashCommandBuilder.d.ts +16 -31
  10. package/dist/build/SlashCommandBuilder.js +122 -0
  11. package/dist/build copy/ContextCommandBuilder.d.ts +37 -0
  12. package/dist/build copy/ContextCommandBuilder.js +88 -0
  13. package/dist/{mjs/build/EventBuilder.d.ts → build copy/EventBuilder.d.ts } +4 -4
  14. package/dist/build copy/EventBuilder.js +34 -0
  15. package/dist/{cjs/build/InhibitorBuilder.d.ts → build copy/InhibitorBuilder.d.ts } +2 -2
  16. package/dist/build copy/InhibitorBuilder.js +27 -0
  17. package/dist/{cjs/build/MessageCommandBuilder.d.ts → build copy/MessageCommandBuilder.d.ts } +14 -34
  18. package/dist/build copy/MessageCommandBuilder.js +90 -0
  19. package/dist/build copy/SlashCommandBuilder.d.ts +41 -0
  20. package/dist/build copy/SlashCommandBuilder.js +122 -0
  21. package/dist/client/DBLClient.d.ts +8 -0
  22. package/dist/client/DBLClient.js +15 -0
  23. package/dist/client/Top.ggClient.d.ts +1 -0
  24. package/dist/client/Top.ggClient.js +1 -0
  25. package/dist/client/XernerxClient.d.ts +54 -0
  26. package/dist/client/XernerxClient.js +90 -0
  27. package/dist/events/messageCreate.d.ts +1 -0
  28. package/dist/events/messageCreate.js +1 -0
  29. package/dist/functions/AsyncFunctions.d.ts +1 -0
  30. package/dist/functions/AsyncFunctions.js +1 -0
  31. package/dist/functions/delay.d.ts +1 -0
  32. package/dist/functions/delay.js +3 -0
  33. package/dist/functions/deploy.d.ts +2 -0
  34. package/dist/functions/deploy.js +29 -0
  35. package/dist/functions/getPermissionBitField.d.ts +2 -0
  36. package/dist/functions/getPermissionBitField.js +17 -0
  37. package/dist/functions/hasVoted.d.ts +1 -0
  38. package/dist/functions/hasVoted.js +1 -0
  39. package/dist/functions/isOwner.d.ts +3 -0
  40. package/dist/functions/isOwner.js +3 -0
  41. package/dist/functions/isVoter.d.ts +3 -0
  42. package/dist/functions/isVoter.js +5 -0
  43. package/dist/functions/load.d.ts +3 -0
  44. package/dist/functions/load.js +32 -0
  45. package/dist/functions/reload.d.ts +2 -0
  46. package/dist/functions/reload.js +39 -0
  47. package/dist/functions/sendWebhook.d.ts +2 -0
  48. package/dist/functions/sendWebhook.js +12 -0
  49. package/dist/functions/voted.d.ts +1 -0
  50. package/dist/functions/voted.js +1 -0
  51. package/dist/functions/xernerxUser.d.ts +3 -0
  52. package/dist/functions/xernerxUser.js +8 -0
  53. package/dist/handlers/CommandHandler.d.ts +13 -0
  54. package/dist/handlers/CommandHandler.js +220 -0
  55. package/dist/handlers/EventHandler.d.ts +7 -0
  56. package/dist/handlers/EventHandler.js +24 -0
  57. package/dist/handlers/ExtensionHandler.d.ts +7 -0
  58. package/dist/handlers/ExtensionHandler.js +19 -0
  59. package/dist/handlers/Handler.d.ts +14 -0
  60. package/dist/handlers/Handler.js +36 -0
  61. package/dist/handlers/InhibitorHandler.d.ts +7 -0
  62. package/dist/handlers/InhibitorHandler.js +24 -0
  63. package/dist/handlers/WebhookHandler.d.ts +7 -0
  64. package/dist/handlers/WebhookHandler.js +50 -0
  65. package/dist/main.d.ts +11 -0
  66. package/dist/main.js +11 -0
  67. package/dist/models/Arguments.d.ts +15 -0
  68. package/dist/models/Arguments.js +129 -0
  69. package/dist/{cjs/models → models}/CommandArguments.js +2 -7
  70. package/dist/{mjs/models → models}/Events.js +44 -56
  71. package/dist/models/Extensions.js +23 -0
  72. package/dist/models/XernerxUser.js +9 -0
  73. package/dist/tools/XernerxError.d.ts +6 -0
  74. package/dist/tools/XernerxError.js +10 -0
  75. package/dist/tools/XernerxLog.d.ts +13 -0
  76. package/dist/tools/XernerxLog.js +30 -0
  77. package/dist/tools/classes.d.ts +6 -0
  78. package/dist/tools/classes.js +10 -0
  79. package/dist/tools/loggers.d.ts +4 -0
  80. package/dist/tools/loggers.js +4 -0
  81. package/dist/{mjs/tools → tools}/package.d.ts +1 -4
  82. package/dist/{cjs/tools → tools}/package.js +11 -16
  83. package/dist/{cjs/types → types}/enums.js +8 -11
  84. package/dist/types/extenders.d.ts +23 -0
  85. package/dist/types/extenders.js +1 -0
  86. package/dist/types/interfaces.d.ts +224 -0
  87. package/dist/types/interfaces.js +1 -0
  88. package/dist/types/options.js +1 -0
  89. package/dist/types/types.d.ts +181 -0
  90. package/dist/types/types.js +1 -0
  91. package/dist/utils/ClientUtil.d.ts +6 -0
  92. package/dist/utils/ClientUtil.js +7 -0
  93. package/dist/{cjs/utils → utils}/CommandUtil.js +14 -29
  94. package/dist/utils/InteractionArguments.d.ts +1 -0
  95. package/dist/utils/InteractionArguments.js +1 -0
  96. package/dist/utils/InteractionUtil.d.ts +10 -0
  97. package/dist/utils/InteractionUtil.js +15 -0
  98. package/dist/utils/MessageUtil.d.ts +11 -0
  99. package/dist/utils/MessageUtil.js +42 -0
  100. package/dist/utils/Util.d.ts +5 -0
  101. package/dist/utils/Util.js +6 -0
  102. package/dist/{mjs/validators → validators}/CommandValidations.js +10 -13
  103. package/dist/validators/InhibitorValidations.d.ts +18 -0
  104. package/dist/validators/InhibitorValidations.js +34 -0
  105. package/dist/validators/commandValidation.d.ts +6 -0
  106. package/dist/validators/commandValidation.js +48 -0
  107. package/dist/validators/commands.d.ts +4 -0
  108. package/dist/validators/commands.js +25 -0
  109. package/package.json +10 -13
  110. package/dist/cjs/build/ContextCommandBuilder.d.ts +0 -63
  111. package/dist/cjs/build/ContextCommandBuilder.js +0 -97
  112. package/dist/cjs/build/EventBuilder.js +0 -44
  113. package/dist/cjs/build/InhibitorBuilder.js +0 -37
  114. package/dist/cjs/build/MessageCommandBuilder.js +0 -100
  115. package/dist/cjs/build/SlashCommandBuilder.js +0 -169
  116. package/dist/cjs/client/XernerxClient.d.ts +0 -29
  117. package/dist/cjs/client/XernerxClient.js +0 -120
  118. package/dist/cjs/handlers/CommandHandler.d.ts +0 -27
  119. package/dist/cjs/handlers/CommandHandler.js +0 -45
  120. package/dist/cjs/handlers/EventHandler.d.ts +0 -13
  121. package/dist/cjs/handlers/EventHandler.js +0 -19
  122. package/dist/cjs/handlers/Handler.d.ts +0 -57
  123. package/dist/cjs/handlers/Handler.js +0 -308
  124. package/dist/cjs/handlers/InhibitorHandler.d.ts +0 -18
  125. package/dist/cjs/handlers/InhibitorHandler.js +0 -24
  126. package/dist/cjs/handlers/WebhookHandler.d.ts +0 -7
  127. package/dist/cjs/handlers/WebhookHandler.js +0 -23
  128. package/dist/cjs/main.d.ts +0 -44
  129. package/dist/cjs/main.js +0 -112
  130. package/dist/cjs/models/Events.js +0 -309
  131. package/dist/cjs/models/Extensions.js +0 -26
  132. package/dist/cjs/models/XernerxUser.js +0 -12
  133. package/dist/cjs/tools/XernerxError.d.ts +0 -5
  134. package/dist/cjs/tools/XernerxError.js +0 -11
  135. package/dist/cjs/tools/package.d.ts +0 -44
  136. package/dist/cjs/types/interfaces.d.ts +0 -27
  137. package/dist/cjs/types/interfaces.js +0 -2
  138. package/dist/cjs/types/options.js +0 -2
  139. package/dist/cjs/types/types.d.ts +0 -62
  140. package/dist/cjs/types/types.js +0 -2
  141. package/dist/cjs/utils/ClientUtil.d.ts +0 -26
  142. package/dist/cjs/utils/ClientUtil.js +0 -211
  143. package/dist/cjs/validators/CommandValidations.js +0 -169
  144. package/dist/cjs/validators/InhibitorValidations.d.ts +0 -11
  145. package/dist/cjs/validators/InhibitorValidations.js +0 -40
  146. package/dist/mjs/build/ContextCommandBuilder.d.ts +0 -63
  147. package/dist/mjs/build/ContextCommandBuilder.js +0 -97
  148. package/dist/mjs/build/EventBuilder.js +0 -44
  149. package/dist/mjs/build/InhibitorBuilder.d.ts +0 -19
  150. package/dist/mjs/build/InhibitorBuilder.js +0 -37
  151. package/dist/mjs/build/MessageCommandBuilder.d.ts +0 -59
  152. package/dist/mjs/build/MessageCommandBuilder.js +0 -100
  153. package/dist/mjs/build/SlashCommandBuilder.d.ts +0 -65
  154. package/dist/mjs/build/SlashCommandBuilder.js +0 -169
  155. package/dist/mjs/client/XernerxClient.d.ts +0 -29
  156. package/dist/mjs/client/XernerxClient.js +0 -120
  157. package/dist/mjs/handlers/CommandHandler.d.ts +0 -27
  158. package/dist/mjs/handlers/CommandHandler.js +0 -45
  159. package/dist/mjs/handlers/EventHandler.d.ts +0 -13
  160. package/dist/mjs/handlers/EventHandler.js +0 -19
  161. package/dist/mjs/handlers/Handler.d.ts +0 -57
  162. package/dist/mjs/handlers/Handler.js +0 -308
  163. package/dist/mjs/handlers/InhibitorHandler.d.ts +0 -18
  164. package/dist/mjs/handlers/InhibitorHandler.js +0 -24
  165. package/dist/mjs/handlers/WebhookHandler.d.ts +0 -7
  166. package/dist/mjs/handlers/WebhookHandler.js +0 -23
  167. package/dist/mjs/main.d.ts +0 -44
  168. package/dist/mjs/main.js +0 -112
  169. package/dist/mjs/models/CommandArguments.d.ts +0 -17
  170. package/dist/mjs/models/CommandArguments.js +0 -106
  171. package/dist/mjs/models/Events.d.ts +0 -24
  172. package/dist/mjs/models/Extensions.d.ts +0 -7
  173. package/dist/mjs/models/Extensions.js +0 -26
  174. package/dist/mjs/models/XernerxUser.d.ts +0 -2
  175. package/dist/mjs/models/XernerxUser.js +0 -12
  176. package/dist/mjs/tools/XernerxError.d.ts +0 -5
  177. package/dist/mjs/tools/XernerxError.js +0 -11
  178. package/dist/mjs/tools/package.js +0 -45
  179. package/dist/mjs/types/enums.d.ts +0 -44
  180. package/dist/mjs/types/enums.js +0 -38
  181. package/dist/mjs/types/interfaces.d.ts +0 -27
  182. package/dist/mjs/types/interfaces.js +0 -2
  183. package/dist/mjs/types/options.d.ts +0 -254
  184. package/dist/mjs/types/options.js +0 -2
  185. package/dist/mjs/types/types.d.ts +0 -62
  186. package/dist/mjs/types/types.js +0 -2
  187. package/dist/mjs/utils/ClientUtil.d.ts +0 -26
  188. package/dist/mjs/utils/ClientUtil.js +0 -211
  189. package/dist/mjs/utils/CommandUtil.d.ts +0 -58
  190. package/dist/mjs/utils/CommandUtil.js +0 -247
  191. package/dist/mjs/validators/CommandValidations.d.ts +0 -12
  192. package/dist/mjs/validators/InhibitorValidations.d.ts +0 -11
  193. package/dist/mjs/validators/InhibitorValidations.js +0 -40
  194. /package/dist/{cjs/models → models}/CommandArguments.d.ts +0 -0
  195. /package/dist/{cjs/models → models}/Events.d.ts +0 -0
  196. /package/dist/{cjs/models → models}/Extensions.d.ts +0 -0
  197. /package/dist/{cjs/models → models}/XernerxUser.d.ts +0 -0
  198. /package/dist/{cjs/types → types}/enums.d.ts +0 -0
  199. /package/dist/{cjs/types → types}/options.d.ts +0 -0
  200. /package/dist/{cjs/utils → utils}/CommandUtil.d.ts +0 -0
  201. /package/dist/{cjs/validators → validators}/CommandValidations.d.ts +0 -0
@@ -1,169 +0,0 @@
1
- 'use strict';
2
- var __createBinding =
3
- (this && this.__createBinding) ||
4
- (Object.create
5
- ? function (o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- var desc = Object.getOwnPropertyDescriptor(m, k);
8
- if (!desc || ('get' in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
- desc = {
10
- enumerable: true,
11
- get: function () {
12
- return m[k];
13
- },
14
- };
15
- }
16
- Object.defineProperty(o, k2, desc);
17
- }
18
- : function (o, m, k, k2) {
19
- if (k2 === undefined) k2 = k;
20
- o[k2] = m[k];
21
- });
22
- var __setModuleDefault =
23
- (this && this.__setModuleDefault) ||
24
- (Object.create
25
- ? function (o, v) {
26
- Object.defineProperty(o, 'default', { enumerable: true, value: v });
27
- }
28
- : function (o, v) {
29
- o['default'] = v;
30
- });
31
- var __importStar =
32
- (this && this.__importStar) ||
33
- function (mod) {
34
- if (mod && mod.__esModule) return mod;
35
- var result = {};
36
- if (mod != null) for (var k in mod) if (k !== 'default' && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
37
- __setModuleDefault(result, mod);
38
- return result;
39
- };
40
- var __importDefault =
41
- (this && this.__importDefault) ||
42
- function (mod) {
43
- return mod && mod.__esModule ? mod : { default: mod };
44
- };
45
- Object.defineProperty(exports, '__esModule', { value: true });
46
- const Discord = __importStar(require('discord.js'));
47
- const discord_js_1 = require('discord.js');
48
- const zod_1 = require('zod');
49
- const XernerxError_js_1 = __importDefault(require('../tools/XernerxError.js'));
50
- const XernerxClient_js_1 = __importDefault(require('../client/XernerxClient.js'));
51
- /**
52
- * @description - The command builder for slash commands.
53
- * @param {String} id - The unique ID of the command.
54
- * @param {SlashCommandOptions} options - The command options.
55
- */
56
- class SlashCommandBuilder {
57
- id;
58
- data;
59
- name;
60
- description;
61
- info;
62
- category;
63
- channelType;
64
- cooldown;
65
- ignore;
66
- strict;
67
- permissions;
68
- args;
69
- subcommands;
70
- groups;
71
- defer;
72
- client;
73
- constructor(id, options) {
74
- this.id = id;
75
- this.data = new Discord.SlashCommandBuilder().setName(options.name).setDescription(options.description);
76
- if (options.args && options?.args?.length > 0) {
77
- this.addArgs(this.data, options.args);
78
- }
79
- if (options.subcommands && options?.subcommands?.length > 0) {
80
- this.addSubcommands(this.data, options.subcommands);
81
- }
82
- if (options.groups && options?.groups?.length > 0) {
83
- this.addSubcommandGroups(options.groups);
84
- }
85
- zod_1.z
86
- .object({
87
- description: zod_1.z.string(),
88
- info: zod_1.z.string(),
89
- category: zod_1.z.string(),
90
- channelType: zod_1.z.array(zod_1.z.number()).or(zod_1.z.number()),
91
- cooldown: zod_1.z.number(),
92
- ignore: zod_1.z.object({
93
- owner: zod_1.z.boolean(),
94
- users: zod_1.z.array(zod_1.z.string()),
95
- channels: zod_1.z.array(zod_1.z.string()),
96
- guilds: zod_1.z.array(zod_1.z.string()),
97
- }),
98
- strict: zod_1.z.object({
99
- owner: zod_1.z.boolean(),
100
- users: zod_1.z.array(zod_1.z.string()),
101
- channels: zod_1.z.array(zod_1.z.string()),
102
- guilds: zod_1.z.array(zod_1.z.string()),
103
- }),
104
- permissions: zod_1.z.object({
105
- client: zod_1.z.array(zod_1.z.string()),
106
- users: zod_1.z.array(zod_1.z.string()),
107
- dm: zod_1.z.boolean(),
108
- }),
109
- defer: zod_1.z.object({
110
- reply: zod_1.z.boolean(),
111
- ephemeral: zod_1.z.boolean(),
112
- fetch: zod_1.z.boolean(),
113
- }),
114
- })
115
- .deepPartial()
116
- .parse(options);
117
- this.name = options.name;
118
- this.description = options.description;
119
- this.info = options.info;
120
- this.category = options.category;
121
- this.channelType = options.channelType;
122
- this.cooldown = options.cooldown;
123
- this.ignore = options.ignore;
124
- this.strict = options.strict;
125
- this.permissions = options.permissions;
126
- this.defer = options.defer;
127
- this.client = XernerxClient_js_1.default;
128
- }
129
- /**
130
- * TODO - update description
131
- * @param interaction
132
- */
133
- async conditions(interaction) {}
134
- /**
135
- * TODO - update description
136
- * @param interaction
137
- */
138
- async exec(interaction) {}
139
- addArgs(command, args) {
140
- const types = ['boolean', 'integer', 'number', 'string', 'user', 'role', 'channel', 'mentionable'];
141
- for (const argument of args) {
142
- if (!types.includes(argument.type.toLowerCase())) throw new XernerxError_js_1.default(`Expected one of ${types.join(', ')}, received ${argument.type} instead.`);
143
- let slashArgumentType = `${argument.type.slice(0, 1).toUpperCase()}${argument.type.slice(1).toLowerCase()}`;
144
- command[`add${slashArgumentType}Option`]((option) => {
145
- option
146
- .setName(argument.name)
147
- .setDescription(argument.description)
148
- .setRequired(argument.required || false);
149
- if (argument.choices) option.setChoices(...argument?.choices);
150
- return option;
151
- });
152
- }
153
- }
154
- addSubcommands(method, subcommands) {
155
- for (const subcommand of subcommands) {
156
- let sub = new discord_js_1.SlashCommandSubcommandBuilder().setName(subcommand.name).setDescription(subcommand.description);
157
- if (subcommand.args?.length > 0) this.addArgs(sub, subcommand.args);
158
- method.addSubcommand(sub);
159
- }
160
- }
161
- addSubcommandGroups(groups) {
162
- for (const group of groups) {
163
- let subcommandGroup = new discord_js_1.SlashCommandSubcommandGroupBuilder().setName(group.name).setDescription(group.description);
164
- if (group.subcommands?.length > 0) this.addSubcommands(subcommandGroup, group.subcommands);
165
- this.data.addSubcommandGroup(subcommandGroup);
166
- }
167
- }
168
- }
169
- exports.default = SlashCommandBuilder;
@@ -1,29 +0,0 @@
1
- import { Client, Collection } from 'discord.js';
2
- import ExtensionBuilder from 'xernerx-extension-builder';
3
- import { ClientUtil } from '../utils/ClientUtil.js';
4
- import { ClientOptions, DiscordOptions, ExtensionOptions, HandlerOptions } from '../types/options.js';
5
- import { ClientCache, ClientCommands, ClientModules } from '../types/interfaces.js';
6
- import EventBuilder from '../build/EventBuilder.js';
7
- import InhibitorBuilder from '../build/InhibitorBuilder.js';
8
- /**
9
- * @description - The Client.
10
- * @param {DiscordOptions} discordOptions - The options for discord.js.
11
- * @param {ClientOptions} clientOptions - The options for the Xernerx Client.
12
- * @extends {Client}
13
- */
14
- export default class XernerxClient extends Client {
15
- settings: ClientOptions;
16
- commands: ClientCommands;
17
- cache: ClientCache;
18
- modules: ClientModules;
19
- util: ClientUtil;
20
- handlerOptions: HandlerOptions;
21
- events: Collection<string, EventBuilder>;
22
- stats: object;
23
- extensions: Record<string, ExtensionBuilder>;
24
- inhibitors: Collection<string, InhibitorBuilder>;
25
- config: object;
26
- constructor(discordOptions: DiscordOptions, clientOptions: ClientOptions, config?: object);
27
- register(token: string): void;
28
- loadAllExtensions(options: ExtensionOptions): Promise<void>;
29
- }
@@ -1,120 +0,0 @@
1
- 'use strict';
2
- var __importDefault =
3
- (this && this.__importDefault) ||
4
- function (mod) {
5
- return mod && mod.__esModule ? mod : { default: mod };
6
- };
7
- Object.defineProperty(exports, '__esModule', { value: true });
8
- const discord_js_1 = require('discord.js');
9
- const zod_1 = require('zod');
10
- const dumfunctions_1 = require('dumfunctions');
11
- const ClientUtil_js_1 = require('../utils/ClientUtil.js');
12
- const CommandHandler_js_1 = __importDefault(require('../handlers/CommandHandler.js'));
13
- const EventHandler_js_1 = __importDefault(require('../handlers/EventHandler.js'));
14
- const InhibitorHandler_js_1 = __importDefault(require('../handlers/InhibitorHandler.js'));
15
- const Extensions_js_1 = __importDefault(require('../models/Extensions.js'));
16
- const WebhookHandler_js_1 = __importDefault(require('../handlers/WebhookHandler.js'));
17
- // TODO - Add commandNotFound as an event to the client.
18
- /**
19
- * @description - The Client.
20
- * @param {DiscordOptions} discordOptions - The options for discord.js.
21
- * @param {ClientOptions} clientOptions - The options for the Xernerx Client.
22
- * @extends {Client}
23
- */
24
- class XernerxClient extends discord_js_1.Client {
25
- settings;
26
- commands;
27
- cache;
28
- modules;
29
- util;
30
- handlerOptions;
31
- events;
32
- stats;
33
- extensions;
34
- inhibitors;
35
- config;
36
- constructor(discordOptions, clientOptions, config) {
37
- super(discordOptions);
38
- this.settings = zod_1.z
39
- .object({
40
- ownerId: zod_1.z.string().or(zod_1.z.array(zod_1.z.string())).default([]),
41
- permissions: zod_1.z
42
- .object({
43
- client: zod_1.z.array(zod_1.z.string()).default([]),
44
- user: zod_1.z.array(zod_1.z.string()).default([]),
45
- dm: zod_1.z.boolean().default(false),
46
- })
47
- .optional(),
48
- ignore: zod_1.z
49
- .object({
50
- owner: zod_1.z.boolean().default(false),
51
- users: zod_1.z.array(zod_1.z.string()),
52
- channels: zod_1.z.array(zod_1.z.string()),
53
- guilds: zod_1.z.array(zod_1.z.string()),
54
- })
55
- .optional(),
56
- log: zod_1.z
57
- .object({
58
- ready: zod_1.z.boolean().default(false),
59
- error: zod_1.z.boolean().default(false),
60
- })
61
- .optional(),
62
- cooldown: zod_1.z
63
- .object({
64
- command: zod_1.z.number().default(0),
65
- cache: zod_1.z.number().default(0),
66
- })
67
- .optional(),
68
- })
69
- .parse(clientOptions);
70
- this.config = config || {};
71
- this.commands = {
72
- message: new discord_js_1.Collection(),
73
- slash: new discord_js_1.Collection(),
74
- context: new discord_js_1.Collection(),
75
- };
76
- this.events = new discord_js_1.Collection();
77
- this.inhibitors = new discord_js_1.Collection();
78
- this.cache = {
79
- messages: new discord_js_1.Collection(),
80
- cooldowns: new discord_js_1.Collection(),
81
- messageCommands: new discord_js_1.Collection(),
82
- slashCommands: new discord_js_1.Collection(),
83
- contextCommands: new discord_js_1.Collection(),
84
- commands: new discord_js_1.Collection(),
85
- };
86
- this.modules = {
87
- commandHandler: new CommandHandler_js_1.default(this),
88
- eventHandler: new EventHandler_js_1.default(this),
89
- inhibitorHandler: new InhibitorHandler_js_1.default(this),
90
- webhookHandler: new WebhookHandler_js_1.default(this),
91
- };
92
- this.stats = {};
93
- this.extensions = {};
94
- this.util = new ClientUtil_js_1.ClientUtil(this);
95
- this.handlerOptions = {};
96
- if (this.settings?.log?.ready) {
97
- this.once('ready', async (client) => {
98
- const size = (await client.guilds.fetch()).size;
99
- console.info(
100
- dumfunctions_1.Style.log(
101
- `Xernerx | ${client.user.tag} signed in watching ${size} server${size > 1 ? 's' : ''}. ${
102
- (this.handlerOptions.slash || this.handlerOptions.context)?.guildId
103
- ? `Using ${(await this.guilds.fetch((this.handlerOptions.slash || this.handlerOptions.context)?.guildId || '0')).name} as local guild.`
104
- : ''
105
- }`,
106
- { color: dumfunctions_1.Style.TextColor.Purple }
107
- )
108
- );
109
- });
110
- }
111
- }
112
- register(token) {
113
- this.login(token);
114
- }
115
- loadAllExtensions(options) {
116
- const extensions = new Extensions_js_1.default(this);
117
- return extensions.load(options.extensions, options.logging || false);
118
- }
119
- }
120
- exports.default = XernerxClient;
@@ -1,27 +0,0 @@
1
- import XernerxClient from '../client/XernerxClient.js';
2
- import { Handler } from './Handler.js';
3
- import { ContextCommandHandlerOptions, MessageCommandHandlerOptions, SlashCommandHandlerOptions } from '../types/options.js';
4
- /**
5
- * @description - The command handler.
6
- * @param {XernerxClient} client - The XernerxClient.
7
- */
8
- export default class CommandHandler {
9
- client: XernerxClient;
10
- handler: Handler;
11
- constructor(client: XernerxClient);
12
- /**
13
- * @description - The message command loader.
14
- * @param {MessageCommandOptions} options - message command loader options.
15
- */
16
- loadAllMessageCommands(options: MessageCommandHandlerOptions): void;
17
- /**
18
- * @description - The slash command loader.
19
- * @param {SlashCommandOptions} options - slash command loader options.
20
- */
21
- loadAllSlashCommands(options: SlashCommandHandlerOptions): void;
22
- /**
23
- * @description - The context command loader.
24
- * @param {ContextCommandOptions} options - context command loader options.
25
- */
26
- loadAllContextCommands(options: ContextCommandHandlerOptions): void;
27
- }
@@ -1,45 +0,0 @@
1
- 'use strict';
2
- Object.defineProperty(exports, '__esModule', { value: true });
3
- const Handler_js_1 = require('./Handler.js');
4
- const Events_js_1 = require('../models/Events.js');
5
- /**
6
- * @description - The command handler.
7
- * @param {XernerxClient} client - The XernerxClient.
8
- */
9
- class CommandHandler {
10
- client;
11
- handler;
12
- constructor(client) {
13
- this.client = client;
14
- this.handler = new Handler_js_1.Handler(client);
15
- new Events_js_1.CommandsDeploy(this.client).deploy();
16
- }
17
- /**
18
- * @description - The message command loader.
19
- * @param {MessageCommandOptions} options - message command loader options.
20
- */
21
- loadAllMessageCommands(options) {
22
- this.handler.loadAllMessageCommands(options);
23
- const events = new Events_js_1.MessageCommandEvents(this.client);
24
- events.messageCreate();
25
- events.messageUpdate();
26
- events.messageDelete();
27
- }
28
- /**
29
- * @description - The slash command loader.
30
- * @param {SlashCommandOptions} options - slash command loader options.
31
- */
32
- loadAllSlashCommands(options) {
33
- this.handler.loadAllSlashCommands(options);
34
- new Events_js_1.SlashCommandEvents(this.client).slashCreate();
35
- }
36
- /**
37
- * @description - The context command loader.
38
- * @param {ContextCommandOptions} options - context command loader options.
39
- */
40
- loadAllContextCommands(options) {
41
- this.handler.loadAllContextCommands(options);
42
- new Events_js_1.ContextCommandEvents(this.client).contextCreate();
43
- }
44
- }
45
- exports.default = CommandHandler;
@@ -1,13 +0,0 @@
1
- import XernerxClient from '../client/XernerxClient.js';
2
- import { EventHandlerOptions } from '../types/options.js';
3
- import { Handler } from './Handler.js';
4
- export default class EventHandler {
5
- client: XernerxClient;
6
- handler: Handler;
7
- constructor(client: XernerxClient);
8
- /**
9
- * @description - The event loader
10
- * @param {EventLoadOptions} options - message command options
11
- */
12
- loadAllEvents(options: EventHandlerOptions): void;
13
- }
@@ -1,19 +0,0 @@
1
- 'use strict';
2
- Object.defineProperty(exports, '__esModule', { value: true });
3
- const Handler_js_1 = require('./Handler.js');
4
- class EventHandler {
5
- client;
6
- handler;
7
- constructor(client) {
8
- this.client = client;
9
- this.handler = new Handler_js_1.Handler(client);
10
- }
11
- /**
12
- * @description - The event loader
13
- * @param {EventLoadOptions} options - message command options
14
- */
15
- loadAllEvents(options) {
16
- return this.handler.loadAllEvents(options);
17
- }
18
- }
19
- exports.default = EventHandler;
@@ -1,57 +0,0 @@
1
- import XernerxClient from '../client/XernerxClient.js';
2
- import { ContextCommandHandlerOptions, EventHandlerOptions, InhibitorHandlerOptions, MessageCommandHandlerOptions, SlashCommandHandlerOptions } from '../types/options.js';
3
- /**
4
- * @description - The Handler class.
5
- * @param {XernerxClient} client - The XernerxClient.
6
- */
7
- export declare class Handler {
8
- private client;
9
- commands: object[];
10
- readyTimestamp: number;
11
- constructor(client: XernerxClient);
12
- /**
13
- * @description - The loader for the message commands.
14
- * @param {MessageCommandOptions} options - The options for the message command loader.
15
- */
16
- loadAllMessageCommands(options: MessageCommandHandlerOptions): void;
17
- /**
18
- * @description - The loader for the slash commands.
19
- * @param {SlashCommandOptions} options - The options for the slash command loader.
20
- */
21
- loadAllSlashCommands(options: SlashCommandHandlerOptions): void;
22
- /**
23
- * @description - The loader for the context commands.
24
- * @param {ContextCommandOptions} options - The options for the context command loader.
25
- */
26
- loadAllContextCommands(options: ContextCommandHandlerOptions): void;
27
- /**
28
- * @description - The loader for the events.
29
- * @param {EventLoadOptions} options - The options for the event loader.
30
- */
31
- loadAllEvents(options: EventHandlerOptions): void;
32
- /**
33
- * @description - The loader for the inhibitors.
34
- * @param {InhibitorLoadOptions} options - The options for the inhibitor loader.
35
- */
36
- loadAllInhibitors(options: InhibitorHandlerOptions): void;
37
- /**
38
- * @description - a reader for directories
39
- * @param {string} dir - the directory to look for.
40
- * @returns array of files.
41
- */
42
- private readdir;
43
- /**
44
- * @description file loader.
45
- * @param {string} dir - the directory.
46
- * @param {string} file - the file in the directory.
47
- * @param {string} type - the type of file.
48
- * @returns undefined
49
- */
50
- private load;
51
- /**
52
- * @description the event emitter to emit all events.
53
- * @param {object} event - the event to be emitted.
54
- * @returns void
55
- */
56
- private emitter;
57
- }