xernerx 0.1.120-beta.2 → 0.1.120-beta.21

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 (68) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +52 -0
  3. package/dist/main.cjs +1269 -266
  4. package/dist/main.cjs.map +1 -1
  5. package/dist/main.d.cts +651 -116
  6. package/dist/main.d.ts +651 -116
  7. package/dist/main.js +1257 -247
  8. package/dist/main.js.map +1 -1
  9. package/package.json +31 -18
  10. package/src/build/XernerxBaseBuilder.ts +21 -0
  11. package/src/build/XernerxEventBuilder.ts +39 -0
  12. package/src/build/XernerxMessageCommandBuilder.ts +60 -0
  13. package/src/build/XernerxSlashCommandBuilder.ts +290 -0
  14. package/src/client/XernerxClient.ts +173 -151
  15. package/src/client/XernerxShardClient.ts +89 -0
  16. package/src/events/clientReady.ts +96 -0
  17. package/src/events/entitlementCreate.ts +15 -0
  18. package/src/events/interactionCreate.ts +36 -0
  19. package/src/events/messageCreate.ts +60 -0
  20. package/src/events/messageDelete.ts +41 -0
  21. package/src/events/messageUpdate.ts +60 -0
  22. package/src/events/slashCommandInteraction.ts +55 -0
  23. package/src/handler/CommandHandler.ts +132 -0
  24. package/src/handler/EventHandler.ts +45 -0
  25. package/src/handler/Handler.ts +98 -0
  26. package/src/interfaces/XernerxClientOptions.ts +13 -0
  27. package/src/interfaces/XernerxClientStats.ts +15 -0
  28. package/src/interfaces/XernerxEventBuilderOptions.ts +9 -0
  29. package/src/interfaces/XernerxMessageCommandBuilderOptions.ts +8 -0
  30. package/src/interfaces/XernerxMessageCommandHandlerOptions.ts +15 -0
  31. package/src/interfaces/XernerxShardClientOptions.ts +5 -0
  32. package/src/interfaces/XernerxSlashCommand.ts +19 -0
  33. package/src/interfaces/XernerxSlashCommandBuilderOptions.ts +70 -0
  34. package/src/interfaces/XernerxSlashCommandHandlerOptions.ts +5 -0
  35. package/src/main.ts +21 -7
  36. package/src/model/XernerxGuild.ts +13 -0
  37. package/src/model/XernerxInteractionArguments.ts +92 -0
  38. package/src/model/XernerxMonitisation.ts +73 -0
  39. package/src/model/XernerxUser.ts +82 -0
  40. package/src/tools/XernerxBase.ts +16 -0
  41. package/src/tools/XernerxError.ts +16 -0
  42. package/src/tools/XernerxInfo.ts +13 -0
  43. package/src/tools/XernerxInitial.ts +28 -0
  44. package/src/tools/XernerxSuccess.ts +13 -0
  45. package/src/tools/XernerxWarn.ts +13 -0
  46. package/src/types/Events.d.ts +21 -0
  47. package/src/types/Interaction.d.ts +90 -0
  48. package/src/types/Message.d.ts +16 -0
  49. package/src/util/XernerxInteractionUtil.ts +82 -0
  50. package/src/util/XernerxMessageUtil.ts +105 -0
  51. package/src/util/XernerxUtil.ts +47 -0
  52. package/src/validators/XernerxBaseValidator.ts +82 -0
  53. package/src/validators/XernerxSlashCommandValidator.ts +11 -0
  54. package/dist/main.global.js +0 -88544
  55. package/dist/main.global.js.map +0 -1
  56. package/src/base/XernerxContextCommand.ts +0 -24
  57. package/src/base/XernerxEvent.ts +0 -21
  58. package/src/base/XernerxInhibitor.ts +0 -21
  59. package/src/base/XernerxMessageCommand.ts +0 -24
  60. package/src/base/XernerxSlashCommand.ts +0 -26
  61. package/src/handlers/CommandHandler.ts +0 -31
  62. package/src/handlers/Handler.ts +0 -57
  63. package/src/tools/XernerxLog.ts +0 -58
  64. package/src/types/interfaces.ts +0 -25
  65. package/src/types/types.ts +0 -29
  66. package/src/util/ClientUtil.ts +0 -29
  67. package/src/util/Util.ts +0 -11
  68. package/src/util/prompts.ts +0 -120
package/dist/main.d.cts CHANGED
@@ -1,167 +1,702 @@
1
- import * as Discord from 'discord.js';
1
+ import { ClusterManager, Cluster, ClusterManagerOptions, ClusterClient } from 'discord-hybrid-sharding';
2
+ import * as discord_js from 'discord.js';
3
+ import { ClientEvents, Locale, InteractionContextType, ApplicationIntegrationType, PermissionFlags, ChannelType, AutocompleteInteraction, AutocompleteFocusedOption, ChatInputCommandInteraction as ChatInputCommandInteraction$1, RestOrArray, SlashCommandBuilder, Permissions, Client as Client$1, RESTGetAPISKUsResult, Collection, ClientOptions, User, Interaction as Interaction$1, Message as Message$1, MessagePayload, WebhookMessageCreateOptions, MessageCreateOptions, MessageEditOptions, MessageReplyOptions, RepliableInteraction, InteractionEditReplyOptions } from 'discord.js';
4
+ export * from 'discord.js';
2
5
 
3
6
  /** @format */
4
- interface XernerxStats {
5
- guilds: null | number;
6
- users: null | number;
7
- shardId: null | number;
8
- shardCount: null | number;
9
- shards: null | number;
10
- voteCount: null | number;
11
- votes: null | number;
7
+ interface XernerxShardClientOptions {
8
+ file: string;
12
9
  }
13
- interface XernerxSlashCommandHandlerOptions {
14
- directory: string;
15
- global: boolean;
10
+
11
+ /** @format */
12
+
13
+ declare class XernerxShardClient extends ClusterManager {
14
+ #private;
15
+ readonly onlineShards: Set<Cluster>;
16
+ readonly stats: {
17
+ onlineSince: number | null;
18
+ guildCount: number | null;
19
+ userCount: number | null;
20
+ shardCount: number | null;
21
+ voteCount: number | null;
22
+ shards: [] | null;
23
+ };
24
+ constructor(options: ClusterManagerOptions & XernerxShardClientOptions);
16
25
  }
17
- interface XernerxMessageCommandHandlerOptions {
18
- directory: string;
19
- global: boolean;
26
+
27
+ /** @format */
28
+ interface XernerxClientOptions {
29
+ token: string;
30
+ global?: boolean;
31
+ guildId?: string | Array<string>;
32
+ owners?: string | Array<string>;
33
+ premium?: {
34
+ owners?: boolean;
35
+ consume?: boolean;
36
+ synchronize?: boolean;
37
+ };
20
38
  }
21
- interface XernerxContextCommandHandlerOptions {
22
- directory: string;
23
- global: boolean;
39
+
40
+ /** @format */
41
+ interface XernerxClientStats {
42
+ onlineSince: number | null;
43
+ guildCount: number | null;
44
+ userCount: number | null;
45
+ shardCount: number | null;
46
+ voteCount: number | null;
47
+ shard: {
48
+ shardId: number | null;
49
+ onlineSince: number | null;
50
+ guildCount: number | null;
51
+ userCount: number | null;
52
+ } | null;
24
53
  }
25
54
 
26
55
  /** @format */
27
- declare class XernerxContextCommand {
28
- readonly _id: string;
29
- readonly name: string;
30
- readonly description: string;
31
- readonly global: boolean;
32
- readonly filetype: 'XernerxContextCommand';
33
- readonly collection: 'context.commands';
34
- constructor(options: any);
56
+ declare class XernerxBase {
57
+ readonly base: () => string;
58
+ constructor();
35
59
  }
36
60
 
37
61
  /** @format */
38
- declare class XernerxEvent {
39
- readonly _id: string;
40
- readonly name: string;
41
- readonly description: string;
62
+
63
+ declare class XernerxError extends XernerxBase {
64
+ constructor(message: string, exit?: number);
65
+ }
66
+
67
+ /** @format */
68
+
69
+ interface XernerxEventBuilderOptions {
70
+ name: ClientEvents | keyof ClientEvents | (string & {});
71
+ emitter?: string;
72
+ once?: boolean;
73
+ }
74
+
75
+ /** @format */
76
+
77
+ interface XernerxSlashCommandBuilderOptions {
78
+ name: string;
79
+ locales?: Partial<Record<Locale, {
80
+ name: string;
81
+ description: string;
82
+ }>>;
83
+ description: string;
84
+ contexts?: Array<keyof typeof InteractionContextType>;
85
+ integration?: Array<keyof typeof ApplicationIntegrationType>;
86
+ nsfw?: boolean;
87
+ options?: Array<XernerxSlashCommandBuilderOption>;
88
+ subcommands?: Array<XernerxSlashCommandBuilderSubcommand>;
89
+ groups?: Array<XernerxSlashCommandBuilderGroup>;
90
+ premium?: boolean;
91
+ defer?: boolean;
92
+ deploy?: {
93
+ global?: boolean;
94
+ guilds?: Array<string> | string;
95
+ };
96
+ info?: string;
97
+ usage?: string;
98
+ category?: string;
99
+ cooldown?: number;
100
+ permissions?: {
101
+ client?: Array<keyof PermissionFlags> | bigint | number | null;
102
+ user?: Array<keyof PermissionFlags> | bigint | number | null;
103
+ };
104
+ strict?: {
105
+ owner?: boolean;
106
+ users?: Array<string>;
107
+ channels?: Array<string>;
108
+ guilds?: Array<string>;
109
+ types?: ChannelType;
110
+ };
111
+ ignore?: {
112
+ owner?: boolean;
113
+ users?: Array<string>;
114
+ channels?: Array<string>;
115
+ guilds?: Array<string>;
116
+ types?: ChannelType;
117
+ };
118
+ }
119
+ interface XernerxSlashCommandBuilderOption {
120
+ type: 'attachment' | 'boolean' | 'channel' | 'integer' | 'mentionable' | 'number' | 'role' | 'string' | 'user';
121
+ name: string;
122
+ locales?: Partial<Record<Locale, {
123
+ name: string;
124
+ description: string;
125
+ }>>;
126
+ description: string;
127
+ required?: boolean;
128
+ autocomplete?: boolean;
129
+ maxLength?: number;
130
+ minLength?: number;
131
+ choices?: Array<{
132
+ name: string;
133
+ value: string;
134
+ locales?: Partial<Record<Locale, string>>;
135
+ }>;
136
+ }
137
+ interface XernerxSlashCommandBuilderSubcommand {
138
+ name: string;
139
+ description: string;
140
+ options?: Array<XernerxSlashCommandBuilderOption>;
141
+ locales?: Partial<Record<Locale, {
142
+ name: string;
143
+ description: string;
144
+ }>>;
145
+ }
146
+ interface XernerxSlashCommandBuilderGroup {
147
+ name: string;
148
+ description: string;
149
+ subcommands: Array<XernerxSlashCommandBuilderSubcommand>;
150
+ locales?: Partial<Record<Locale, {
151
+ name: string;
152
+ description: string;
153
+ }>>;
154
+ }
155
+
156
+ /** @format */
157
+
158
+ declare class XernerxBaseBuilder {
159
+ readonly id: string;
160
+ client: XernerxClient;
161
+ /**
162
+ * Constructs a new instance of the XernerxBaseBuilder class.
163
+ *
164
+ * @param id - A unique identifier for the builder instance.
165
+ * @param options - Configuration options for the builder, which can be either
166
+ * XernerxSlashCommandBuilderOptions or XernerxEventBuilderOptions.
167
+ */
168
+ constructor(id: string, options: XernerxSlashCommandBuilderOptions | XernerxEventBuilderOptions);
169
+ }
170
+
171
+ /** @format */
172
+
173
+ declare class XernerxEventBuilder extends XernerxBaseBuilder {
42
174
  readonly filetype: 'XernerxEvent';
43
- readonly collection: 'events';
44
- constructor(options: any);
175
+ readonly name: ClientEvents | keyof ClientEvents | (string & {});
176
+ readonly emitter: string;
177
+ readonly once: boolean;
178
+ constructor(id: string, options: XernerxEventBuilderOptions);
179
+ /**
180
+ * Executes the event logic. This method should be overridden in subclasses to provide specific event handling.
181
+ *
182
+ * @param args - A variable number of arguments that are passed to the event handler.
183
+ * These arguments are specific to the event being handled.
184
+ * @returns A promise that resolves when the event handling is complete.
185
+ * The resolved value can be any type, depending on the implementation in subclasses.
186
+ */
187
+ run(...args: any[]): Promise<any | void>;
45
188
  }
46
189
 
47
190
  /** @format */
48
- declare class XernerxInhibitor {
49
- readonly _id: string;
50
- readonly name: string;
51
- readonly description: string;
52
- readonly filetype: 'XernerxInhibitor';
53
- readonly collection: 'inhibitors';
54
- constructor(options: any);
191
+ interface XernerxMessageCommandBuilderOptions {
192
+ name: string;
193
+ alias?: string | string[];
194
+ prefix?: string | string[];
195
+ premium?: any;
55
196
  }
56
197
 
57
198
  /** @format */
58
- declare class XernerxMessageCommand {
59
- readonly _id: string;
199
+
200
+ declare class XernerxMessageCommandBuilder extends XernerxBaseBuilder {
201
+ readonly filetype: 'XernerxMessageCommand';
60
202
  readonly name: string;
61
203
  readonly description: string;
62
- readonly global: boolean;
63
- readonly filetype: 'XernerxMessageCommand';
64
- readonly collection: 'message.commands';
65
- constructor(options: any);
204
+ readonly alias: string[];
205
+ readonly prefix: string[];
206
+ readonly premium: Array<string>;
207
+ /**
208
+ * Constructs an instance of XernerxMessageCommandBuilder.
209
+ *
210
+ * @param id - A unique identifier for the command.
211
+ * @param options - An object containing configuration options for the command.
212
+ * @param options.name - The name of the command.
213
+ * @param options.alias - An alias or an array of aliases for the command.
214
+ * @param options.prefix - A prefix or an array of prefixes for the command.
215
+ * @param options.premium - An array indicating premium features or settings.
216
+ */
217
+ constructor(id: string, options: XernerxMessageCommandBuilderOptions);
218
+ /**
219
+ * Executes the command logic. This function is intended to be overridden by subclasses.
220
+ * If not overridden, it will log a warning indicating that the command will not respond.
221
+ *
222
+ * @param args - A variable number of arguments that can be passed to the command execution.
223
+ * @returns A promise that resolves to any value, depending on the implementation.
224
+ */
225
+ exec(...args: any[]): Promise<any>;
66
226
  }
67
227
 
68
228
  /** @format */
69
229
 
70
- declare class XernerxSlashCommand extends Discord.SlashCommandBuilder {
71
- readonly _id: string;
72
- readonly global: boolean;
73
- readonly filetype: 'XernerxSlashCommand';
74
- readonly collection: 'slash.commands';
75
- constructor(options: any);
230
+ interface XernerxSlashCommand {
231
+ interaction: ChatInputCommandInteraction$1;
232
+ options?: Record<string, {
233
+ name: string;
234
+ type: number;
235
+ value: string | number | boolean | object;
236
+ }> | null;
237
+ subcommand: string | null;
238
+ group: string | null;
239
+ command: XernerxSlashCommandBuilder$1;
240
+ }
241
+ interface XernerxSlashCommandAutocomplete {
242
+ interaction: AutocompleteInteraction;
243
+ focused: AutocompleteFocusedOption;
244
+ options: any;
76
245
  }
77
246
 
78
247
  /** @format */
79
248
 
80
- type XernerxFileType = 'XernerxSlashCommand' | 'XernerxMessageCommand' | 'XernerxContextCommand' | 'XernerxEvent' | 'XernerxInhibitor';
81
- type XernerxFile<T = XernerxFileType> = T extends 'XernerxSlashCommand' ? XernerxSlashCommand : T extends 'XernerxMessageCommand' ? XernerxMessageCommand : T extends 'XernerxContextCommand' ? XernerxContextCommand : T extends 'XernerxEvent' ? XernerxEvent : T extends 'XernerxInhibitor' ? XernerxInhibitor : XernerxSlashCommand | XernerxMessageCommand | XernerxSlashCommand | XernerxEvent | XernerxInhibitor;
82
-
83
- /** @format */
249
+ declare class XernerxSlashCommandBuilder$1 extends XernerxBaseBuilder {
250
+ readonly name: string;
251
+ readonly description: string;
252
+ readonly integration: RestOrArray<InteractionContextType>;
253
+ readonly data: SlashCommandBuilder;
254
+ readonly options: Array<XernerxSlashCommandBuilderOption>;
255
+ readonly subcommands: Array<XernerxSlashCommandBuilderSubcommand>;
256
+ readonly groups: Array<XernerxSlashCommandBuilderGroup>;
257
+ readonly premium?: boolean;
258
+ readonly defer?: boolean;
259
+ readonly deploy?: {
260
+ global?: boolean;
261
+ guilds?: Array<string> | string;
262
+ };
263
+ readonly info?: string;
264
+ readonly usage?: string;
265
+ readonly category?: string;
266
+ readonly cooldown?: number;
267
+ readonly permissions: {
268
+ client: Permissions | number | bigint | null;
269
+ user: Permissions | number | bigint | null;
270
+ };
271
+ readonly strict?: {
272
+ owner?: boolean;
273
+ users?: Array<string>;
274
+ channels?: Array<string>;
275
+ guilds?: Array<string>;
276
+ types?: ChannelType;
277
+ };
278
+ readonly ignore?: {
279
+ owner?: boolean;
280
+ users?: Array<string>;
281
+ channels?: Array<string>;
282
+ guilds?: Array<string>;
283
+ types?: ChannelType;
284
+ };
285
+ readonly filetype: 'XernerxSlashCommand';
286
+ constructor(id: string, options: XernerxSlashCommandBuilderOptions);
287
+ /**
288
+ * Handles the autocomplete functionality for a slash command.
289
+ *
290
+ * @param args - The arguments for the autocomplete function, which include the context and options for the command.
291
+ * @returns A promise that resolves to either void or any value, depending on the implementation.
292
+ */
293
+ autocomplete(args: XernerxSlashCommandAutocomplete): Promise<void | any>;
294
+ /**
295
+ * Evaluates conditions for executing a slash command.
296
+ *
297
+ * @param args - The arguments for the conditions function, which include the context and options for the command.
298
+ * @returns A promise that resolves to either void or any value, depending on the implementation.
299
+ */
300
+ conditions(args: XernerxSlashCommand): Promise<void | any>;
301
+ /**
302
+ * Executes the slash command.
303
+ *
304
+ * @param args - The arguments for the exec function, which include the context and options for the command.
305
+ * @returns A promise that resolves to either void or any value, depending on the implementation.
306
+ */
307
+ exec(args: XernerxSlashCommand): Promise<void | any>;
308
+ private addArguments;
309
+ private addSubcommands;
310
+ /**
311
+ * Adds subcommand groups to the slash command builder.
312
+ *
313
+ * @param groups - An array of subcommand groups to be added. Each group contains a name, description, locales, and subcommands.
314
+ */
315
+ private addSubcommandGroups;
316
+ }
84
317
 
85
318
  declare class Handler {
86
319
  readonly client: XernerxClient;
320
+ [index: string]: Record<string, any>;
87
321
  constructor(client: XernerxClient);
88
- protected readdir(directory: string): Promise<string[]>;
89
- protected load(filepath: string): Promise<XernerxFile | null>;
322
+ /**
323
+ * Loads JavaScript files from a specified directory.
324
+ *
325
+ * @param dir - The directory path from which to load the files.
326
+ * @returns An array of file paths for JavaScript files in the specified directory.
327
+ * Returns an empty array if an error occurs during the file reading process.
328
+ */
329
+ loadFiles(dir: string): string[];
330
+ /**
331
+ * Asynchronously loads a JavaScript file and imports its default export.
332
+ *
333
+ * @param file - The path to the JavaScript file to be loaded.
334
+ * @returns A promise that resolves when the file is successfully loaded and imported.
335
+ * If the file does not have a default export, an error is thrown.
336
+ */
337
+ loadFile(file: string): Promise<XernerxError | undefined>;
338
+ /**
339
+ * Imports a file by registering it with the client based on its type.
340
+ *
341
+ * @param builder - An instance of XernerxEventBuilder, XernerxMessageCommandBuilder, or XernerxSlashCommandBuilder.
342
+ * This object contains the necessary information to register the file with the client.
343
+ * @param filename - An optional string representing the name of the file being imported.
344
+ * Used for error reporting if the builder ID is not unique.
345
+ * @returns The builder object after it has been registered with the client.
346
+ * If the builder is of type XernerxEvent, it is registered as an event listener.
347
+ * If the builder is of type XernerxMessageCommand or XernerxSlashCommand, it is registered as a command.
348
+ */
349
+ importFile(builder: XernerxEventBuilder | XernerxMessageCommandBuilder | XernerxSlashCommandBuilder$1, filename?: string): Promise<XernerxError | XernerxEventBuilder | XernerxMessageCommandBuilder | XernerxSlashCommandBuilder$1>;
90
350
  }
91
351
 
92
- /** @format */
93
-
94
- declare class CommandHandler extends Handler {
352
+ declare class EventHandler extends Handler {
95
353
  constructor(client: XernerxClient);
96
- protected loadSlashCommands(options: XernerxSlashCommandHandlerOptions): Promise<void>;
97
- protected loadMessageCommands(options: XernerxMessageCommandHandlerOptions): Promise<void>;
98
- protected loadContextCommands(options: XernerxContextCommandHandlerOptions): Promise<void>;
354
+ /**
355
+ * Loads a single event file.
356
+ *
357
+ * @param file - The path to the event file to be loaded.
358
+ * @returns A promise that resolves when the event file has been successfully loaded.
359
+ */
360
+ loadEvent(file: string): Promise<XernerxError | undefined>;
361
+ /**
362
+ * Loads all event files from the specified directory and initializes them.
363
+ *
364
+ * @param options - An object containing options for loading events.
365
+ * @param options.directory - The directory path where event files are located.
366
+ * @returns A promise that resolves when all events have been loaded.
367
+ */
368
+ loadEvents(options: {
369
+ directory: string;
370
+ }): Promise<void>;
99
371
  }
100
372
 
101
373
  /** @format */
374
+ interface XernerxMessageCommandHandlerOptions {
375
+ directory: string | null;
376
+ prefix?: string | string[];
377
+ mention?: boolean;
378
+ seperator?: string;
379
+ handleEdits?: boolean;
380
+ handleDeletions?: boolean;
381
+ ignore?: {
382
+ system?: boolean;
383
+ bots?: boolean;
384
+ self?: boolean;
385
+ };
386
+ }
102
387
 
103
- declare class Util {
104
- readonly client: XernerxClient;
105
- constructor(client: XernerxClient);
388
+ /** @format */
389
+ interface XernerxSlashCommandHandlerOptions {
390
+ directory: string | null;
106
391
  }
107
392
 
108
393
  /** @format */
109
394
 
110
- declare class ClientUtil extends Util {
395
+ declare class CommandHandler extends Handler {
111
396
  constructor(client: XernerxClient);
112
- uptime(timestamp?: number | null): string;
397
+ /**
398
+ * Loads a message command from a specified file.
399
+ *
400
+ * @param file - The path to the file containing the message command to be loaded.
401
+ * @returns A promise that resolves when the file has been successfully loaded.
402
+ */
403
+ loadMessageCommand(file: string): Promise<XernerxError | undefined>;
404
+ /**
405
+ * Loads message commands based on the provided options.
406
+ *
407
+ * @param options - Configuration options for loading message commands, including directory, prefix, mention, separator, handleEdits, handleDeletions, and ignore settings.
408
+ * @returns A promise that resolves when all message commands have been successfully loaded.
409
+ */
410
+ loadMessageCommands(options: XernerxMessageCommandHandlerOptions): Promise<void>;
411
+ /**
412
+ * Loads a slash command from a specified file.
413
+ *
414
+ * @param file - The path to the file containing the slash command to be loaded.
415
+ * @returns A promise that resolves when the file has been successfully loaded.
416
+ */
417
+ loadSlashCommand(file: string): Promise<XernerxError | undefined>;
418
+ /**
419
+ * Loads slash commands based on the provided options.
420
+ *
421
+ * @param options - Configuration options for loading slash commands, including the directory where the command files are located.
422
+ * @returns A promise that resolves when all slash commands have been successfully loaded.
423
+ */
424
+ loadSlashCommands(options: XernerxSlashCommandHandlerOptions): Promise<void>;
425
+ /**
426
+ * Loads and imports event files based on the provided event classes.
427
+ *
428
+ * @param args - An array of event classes extending XernerxEventBuilder. Each class represents an event to be loaded and imported.
429
+ * @returns A promise that resolves when all specified events have been successfully imported.
430
+ */
431
+ private loadEvents;
113
432
  }
114
433
 
115
434
  /** @format */
116
435
 
117
- declare class XernerxClient<T = {}> extends Discord.Client {
118
- readonly settings: {
119
- token: string;
120
- global: boolean;
121
- owners: string[];
122
- guilds: string[];
123
- debug: boolean;
436
+ declare class XernerxClient extends Client$1 {
437
+ readonly token: string;
438
+ readonly sharded: boolean;
439
+ readonly settings: XernerxClientOptions;
440
+ readonly premium: {
441
+ owners?: boolean;
442
+ consume?: boolean;
443
+ synchronize?: boolean;
124
444
  };
125
- readonly stats: XernerxStats;
445
+ readonly monitisation: {
446
+ skus: RESTGetAPISKUsResult;
447
+ };
448
+ readonly stats: XernerxClientStats;
449
+ readonly cluster: ClusterClient | null;
450
+ readonly cache: {
451
+ messages: Collection<string, string>;
452
+ slash: Collection<string, string>;
453
+ };
454
+ readonly handler: {
455
+ message: XernerxMessageCommandHandlerOptions;
456
+ slash: XernerxSlashCommandHandlerOptions;
457
+ };
458
+ readonly commands: {
459
+ message: Collection<string, XernerxMessageCommandBuilder>;
460
+ slash: Collection<string, XernerxSlashCommandBuilder$1>;
461
+ };
462
+ readonly events: Collection<string, XernerxEventBuilder>;
126
463
  readonly modules: {
464
+ eventHandler: EventHandler;
127
465
  commandHandler: CommandHandler;
128
- options: {
129
- message?: {
130
- global?: boolean;
131
- };
132
- slash?: {
133
- global?: boolean;
134
- };
135
- context?: {
136
- global?: boolean;
137
- };
138
- };
139
- };
140
- readonly util: ClientUtil;
141
- readonly commands: {
142
- message: Discord.Collection<string, XernerxMessageCommand>;
143
- slash: Discord.Collection<string, XernerxSlashCommand>;
144
- context: Discord.Collection<string, XernerxContextCommand>;
145
- stats: {
146
- slash: {
147
- local: number;
148
- global: number;
149
- };
150
- message: {
151
- local: number;
152
- global: number;
153
- };
154
- context: {
155
- local: number;
156
- global: number;
157
- };
158
- };
159
- };
160
- readonly events: Discord.Collection<string, XernerxEvent>;
161
- readonly inhibitors: Discord.Collection<string, XernerxInhibitor>;
162
- constructor(DiscordOptions: any, XernerxOptions: any, config: T);
163
- private connect;
164
- private deploy;
165
- }
166
-
167
- export { XernerxClient, XernerxSlashCommand };
466
+ };
467
+ constructor(options: ClientOptions & XernerxClientOptions);
468
+ /**
469
+ * Connects the client to Discord and initializes various client statistics and handlers.
470
+ *
471
+ * @returns A promise that resolves when the client successfully logs in, or rejects with an error message if the login fails.
472
+ */
473
+ connect(): Promise<string | XernerxError>;
474
+ }
475
+
476
+ declare class XernerxUser extends User {
477
+ #private;
478
+ constructor(client: Client$1<true> | XernerxClient, user: User);
479
+ /**
480
+ * Checks if the user has any entitlements, indicating premium status.
481
+ *
482
+ * @param id - The ID of the user to check for premium entitlements.
483
+ * @returns A promise that resolves to a boolean indicating whether the user has any entitlements (true) or not (false).
484
+ */
485
+ premium(id: string): Promise<boolean>;
486
+ /**
487
+ * Retrieves the entitlements for the user and maps them to their corresponding SKU.
488
+ *
489
+ * @returns A promise that resolves to an array of objects, each containing an entitlement and its associated SKU.
490
+ */
491
+ entitlements(): Promise<{
492
+ entitlement: discord_js.APIEntitlement;
493
+ sku: discord_js.APISKU | undefined;
494
+ }[]>;
495
+ /**
496
+ * Synchronizes the user's entitlements with the current SKU data and performs necessary actions
497
+ * such as consuming, deleting, or creating entitlements based on their type and the client's premium settings.
498
+ *
499
+ * @returns A promise that resolves to an array of error messages, if any occurred during the synchronization process.
500
+ */
501
+ synchronize(): Promise<string[]>;
502
+ }
503
+
504
+ /** @format */
505
+
506
+ declare class XernerxBaseUtil {
507
+ readonly client: XernerxClient & Client$1<true>;
508
+ readonly parsed: {
509
+ command: string | null;
510
+ alias: string | null;
511
+ mention: boolean | null;
512
+ prefix: string | null;
513
+ };
514
+ interaction: Interaction$1 | Message$1;
515
+ constructor(client: XernerxClient & Client$1<true>, interaction: Interaction$1 | Message$1);
516
+ /**
517
+ * Sends a message using a webhook in the current interaction's channel.
518
+ *
519
+ * @param options - The message content or options to send via the webhook. This can be a string, MessagePayload, or WebhookMessageCreateOptions.
520
+ * @returns A promise that resolves to the message sent by the webhook.
521
+ */
522
+ webhook(options: string | MessagePayload | WebhookMessageCreateOptions): Promise<Message$1<boolean> | undefined>;
523
+ }
524
+
525
+ /** @format */
526
+
527
+ declare class XernerxMessageUtil extends XernerxBaseUtil {
528
+ #private;
529
+ readonly message: Message$1;
530
+ readonly cache: Collection<string, string>;
531
+ args: string[];
532
+ constructor(client: XernerxClient & Client$1<true>, message: Message$1);
533
+ /**
534
+ * Sends a message to the channel or edits an existing message if applicable.
535
+ *
536
+ * @param options - The content or options for the message to be sent or edited.
537
+ * It can be a string, MessagePayload, MessageCreateOptions, or MessageEditOptions.
538
+ * @returns The sent or edited message, or null if the message ID is not found in the cache.
539
+ */
540
+ send(options: string | MessagePayload | MessageCreateOptions | MessageEditOptions): Promise<Message$1<boolean> | null>;
541
+ /**
542
+ * Replies to the current message or edits an existing reply if applicable.
543
+ *
544
+ * @param options - The content or options for the reply message.
545
+ * It can be a string, MessagePayload, or MessageReplyOptions.
546
+ * @returns The sent or edited message, or null if the message ID is not found in the cache.
547
+ */
548
+ reply(options: string | MessagePayload | MessageReplyOptions): Promise<Message$1<boolean> | null>;
549
+ }
550
+
551
+ /** @format */
552
+
553
+
554
+ declare module 'discord.js' {
555
+ interface Message {
556
+ user: XernerxUser;
557
+ client: Client<true> & XernerxClient;
558
+ util: XernerxMessageUtil;
559
+ }
560
+ }
561
+
562
+ declare class XernerxInteractionUtil extends XernerxBaseUtil {
563
+ readonly interaction: RepliableInteraction;
564
+ readonly cache: Collection<string, string>;
565
+ args: string[];
566
+ constructor(client: XernerxClient & Client$1<true>, interaction: Interaction$1);
567
+ /**
568
+ * Sends a message to the channel associated with the interaction.
569
+ *
570
+ * @param options - The content or options for the message to be sent. It can be a string, MessagePayload, or MessageCreateOptions.
571
+ * @returns A promise that resolves to the sent message.
572
+ * @throws {XernerxError} Throws an error if the options parameter is not provided.
573
+ */
574
+ send(options: string | MessagePayload | MessageCreateOptions): Promise<discord_js.Message<true>>;
575
+ /**
576
+ * Replies to the interaction with the provided options.
577
+ *
578
+ * @param options - The content or options for the reply. It can be a string, MessagePayload, or InteractionEditReplyOptions.
579
+ * @returns A promise that resolves to the sent message or the edited reply.
580
+ * @throws {XernerxError} Throws an error if the options parameter is not provided.
581
+ */
582
+ reply(options: string | MessagePayload | InteractionEditReplyOptions): Promise<discord_js.Message<boolean> | discord_js.InteractionResponse<boolean>>;
583
+ /**
584
+ * Sends a message to the channel associated with the interaction with componentsV2 flag.
585
+ *
586
+ * @param options - The options for the message to be sent, including content and other message properties.
587
+ * @returns A promise that resolves to the sent message.
588
+ */
589
+ send2(options: MessageCreateOptions): Promise<discord_js.Message<true>>;
590
+ /**
591
+ * Replies to the interaction with the provided options, using the componentsV2 flag.
592
+ *
593
+ * @param options - The options for the reply, including content and other message properties.
594
+ * @returns A promise that resolves to the sent message or the edited reply.
595
+ */
596
+ reply2(options: InteractionEditReplyOptions): Promise<discord_js.Message<boolean> | discord_js.InteractionResponse<boolean>>;
597
+ }
598
+
599
+ /** @format */
600
+
601
+
602
+
603
+ declare module 'discord.js' {
604
+ interface Interaction {
605
+ user: XernerxUser;
606
+ client: Client<true> & XernerxClient;
607
+ util: XernerxInteractionUtil;
608
+ }
609
+
610
+ interface ChatInputCommandInteraction {
611
+ user: XernerxUser;
612
+ client: Client<true> & XernerxClient;
613
+ util: XernerxInteractionUtil;
614
+ }
615
+
616
+ interface MessageContextMenuCommandInteraction {
617
+ user: XernerxUser;
618
+ client: Client<true> & XernerxClient;
619
+ util: XernerxInteractionUtil;
620
+ }
621
+
622
+ interface UserContextMenuCommandInteraction {
623
+ user: XernerxUser;
624
+ client: Client<true> & XernerxClient;
625
+ util: XernerxInteractionUtil;
626
+ }
627
+
628
+ interface PrimaryEntryPointCommandInteraction {
629
+ user: XernerxUser;
630
+ client: Client<true> & XernerxClient;
631
+ util: XernerxInteractionUtil;
632
+ }
633
+
634
+ interface StringSelectMenuInteraction {
635
+ user: XernerxUser;
636
+ client: Client<true> & XernerxClient;
637
+ util: XernerxInteractionUtil;
638
+ }
639
+
640
+ interface UserSelectMenuInteraction {
641
+ user: XernerxUser;
642
+ client: Client<true> & XernerxClient;
643
+ util: XernerxInteractionUtil;
644
+ }
645
+
646
+ interface RoleSelectMenuInteraction {
647
+ user: XernerxUser;
648
+ client: Client<true> & XernerxClient;
649
+ util: XernerxInteractionUtil;
650
+ }
651
+
652
+ interface MentionableSelectMenuInteraction {
653
+ user: XernerxUser;
654
+ client: Client<true> & XernerxClient;
655
+ util: XernerxInteractionUtil;
656
+ }
657
+
658
+ interface ChannelSelectMenuInteraction {
659
+ user: XernerxUser;
660
+ client: Client<true> & XernerxClient;
661
+ util: XernerxInteractionUtil;
662
+ }
663
+
664
+ interface ButtonInteraction {
665
+ user: XernerxUser;
666
+ client: Client<true> & XernerxClient;
667
+ util: XernerxInteractionUtil;
668
+ }
669
+
670
+ interface AutocompleteInteraction {
671
+ user: XernerxUser;
672
+ client: Client<true> & XernerxClient;
673
+ util: XernerxInteractionUtil;
674
+ }
675
+
676
+ interface ModalSubmitInteraction {
677
+ user: XernerxUser;
678
+ client: Client<true> & XernerxClient;
679
+ util: XernerxInteractionUtil;
680
+ }
681
+ }
682
+
683
+ /** @format */
684
+
685
+
686
+
687
+ declare module 'discord.js' {
688
+ interface ClientEvents {
689
+ selectMenuInteraction: [interaction: AnySelectMenuInteraction];
690
+ buttonInteraction: [interaction: ButtonInteraction];
691
+ modalInteraction: [interaction: ModalSubmitInteraction];
692
+ contextCommandInteraction: [interaction: ContextMenuCommandInteraction];
693
+ slashCommandInteraction: [interaction: ChatInputCommandInteraction];
694
+ commandError: [interaction: Interaction | Message, args: any, command: XernerxSlashCommandBuilder | XernerxMessageCommandBuilder, error: Error];
695
+ commandBlock: [interaction: Interaction | Message, command: XernerxSlashCommandBuilder | XernerxMessageCommandBuilder, error: any];
696
+ commandStart: [interaction: Interaction | Message, args: any, command: XernerxSlashCommandBuilder | XernerxMessageCommandBuilder];
697
+ commandFinish: [interaction: Interaction | Message, args: any, command: XernerxSlashCommandBuilder | XernerxMessageCommandBuilder];
698
+ commandDelete: [interaction: Interaction | Message, error: Error];
699
+ }
700
+ }
701
+
702
+ export { XernerxClient, XernerxEventBuilder, XernerxMessageCommandBuilder, XernerxShardClient, type XernerxSlashCommand, type XernerxSlashCommandAutocomplete, XernerxSlashCommandBuilder$1 as XernerxSlashCommandBuilder };