commandkit 0.1.11-dev.20241214174243 → 0.1.11-dev.20241214181517

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 (52) hide show
  1. package/dist/{CommandKit-D84HlsL0.d.mts → CommandKit-DV84yztA.d.mts} +134 -149
  2. package/dist/{CommandKit-Co5QNlps.d.ts → CommandKit-pPD1Tn9T.d.ts} +134 -149
  3. package/dist/CommandKit.d.mts +1 -2
  4. package/dist/CommandKit.d.ts +1 -2
  5. package/dist/CommandKit.js +2 -2
  6. package/dist/CommandKit.js.map +1 -1
  7. package/dist/CommandKit.mjs +1 -1
  8. package/dist/chunk-KWCOZDFY.mjs +2 -0
  9. package/dist/chunk-KWCOZDFY.mjs.map +1 -0
  10. package/dist/{chunk-X5PINE7S.mjs → chunk-SVLWLCWB.mjs} +2 -2
  11. package/dist/chunk-SVLWLCWB.mjs.map +1 -0
  12. package/dist/handlers/command-handler/CommandHandler.d.mts +1 -2
  13. package/dist/handlers/command-handler/CommandHandler.d.ts +1 -2
  14. package/dist/handlers/command-handler/CommandHandler.js +2 -2
  15. package/dist/handlers/command-handler/CommandHandler.js.map +1 -1
  16. package/dist/handlers/command-handler/CommandHandler.mjs +1 -1
  17. package/dist/handlers/command-handler/functions/loadCommandsWithRest.d.mts +1 -2
  18. package/dist/handlers/command-handler/functions/loadCommandsWithRest.d.ts +1 -2
  19. package/dist/handlers/command-handler/functions/registerCommands.d.mts +1 -2
  20. package/dist/handlers/command-handler/functions/registerCommands.d.ts +1 -2
  21. package/dist/handlers/command-handler/typings.d.mts +1 -2
  22. package/dist/handlers/command-handler/typings.d.ts +1 -2
  23. package/dist/handlers/command-handler/typings.js.map +1 -1
  24. package/dist/handlers/command-handler/validations/devOnly.d.mts +1 -2
  25. package/dist/handlers/command-handler/validations/devOnly.d.ts +1 -2
  26. package/dist/handlers/command-handler/validations/index.d.mts +1 -2
  27. package/dist/handlers/command-handler/validations/index.d.ts +1 -2
  28. package/dist/handlers/command-handler/validations/permissions.d.mts +1 -2
  29. package/dist/handlers/command-handler/validations/permissions.d.ts +1 -2
  30. package/dist/handlers/event-handler/EventHandler.d.mts +1 -2
  31. package/dist/handlers/event-handler/EventHandler.d.ts +1 -2
  32. package/dist/handlers/event-handler/typings.d.mts +1 -2
  33. package/dist/handlers/event-handler/typings.d.ts +1 -2
  34. package/dist/handlers/index.d.mts +1 -2
  35. package/dist/handlers/index.d.ts +1 -2
  36. package/dist/handlers/index.js +2 -2
  37. package/dist/handlers/index.js.map +1 -1
  38. package/dist/handlers/index.mjs +1 -1
  39. package/dist/index.d.mts +1 -2
  40. package/dist/index.d.ts +1 -2
  41. package/dist/index.js +2 -2
  42. package/dist/index.js.map +1 -1
  43. package/dist/index.mjs +1 -1
  44. package/dist/index.mjs.map +1 -1
  45. package/dist/types.d.mts +1 -2
  46. package/dist/types.d.ts +1 -2
  47. package/dist/types.js.map +1 -1
  48. package/dist/types.mjs.map +1 -1
  49. package/package.json +4 -1
  50. package/dist/chunk-FBYSGXIA.mjs +0 -2
  51. package/dist/chunk-FBYSGXIA.mjs.map +0 -1
  52. package/dist/chunk-X5PINE7S.mjs.map +0 -1
@@ -1,145 +1,6 @@
1
1
  import { ValidationHandler } from './handlers/validation-handler/ValidationHandler.mjs';
2
2
  import * as discord_js from 'discord.js';
3
- import { Client, ChatInputCommandInteraction, ContextMenuCommandInteraction, AutocompleteInteraction, Interaction, CacheType, UserContextMenuCommandInteraction, MessageContextMenuCommandInteraction, PermissionsString, RESTPostAPIApplicationCommandsJSONBody } from 'discord.js';
4
- import { AsyncLocalStorage } from 'async_hooks';
5
-
6
- /**
7
- * Command handler options.
8
- * Similar to CommandKit options in structure.
9
- */
10
- interface CommandHandlerOptions {
11
- /**
12
- * The client created by the user.
13
- */
14
- client: Client;
15
- /**
16
- * Path to the user's commands.
17
- */
18
- commandsPath: string;
19
- /**
20
- * An array of developer guild IDs.
21
- */
22
- devGuildIds: string[];
23
- /**
24
- * An array of developer user IDs.
25
- */
26
- devUserIds: string[];
27
- /**
28
- * An array of developer role IDs.
29
- */
30
- devRoleIds: string[];
31
- /**
32
- * A validation handler instance to run validations before commands.
33
- */
34
- validationHandler?: ValidationHandler;
35
- /**
36
- * A boolean indicating whether to skip CommandKit's built-in validations (permission checking, etc.)
37
- */
38
- skipBuiltInValidations: boolean;
39
- /**
40
- * The CommandKit handler that instantiated this.
41
- */
42
- commandkitInstance: CommandKit;
43
- /**
44
- * A boolean indicating whether to register all commands in bulk.
45
- */
46
- bulkRegister: boolean;
47
- /**
48
- * Whether to enable hooks context.
49
- */
50
- enableHooks: boolean;
51
- }
52
- /**
53
- * Private command handler data.
54
- */
55
- interface CommandHandlerData extends CommandHandlerOptions {
56
- /**
57
- * An array of command file objects.
58
- */
59
- commands: CommandFileObject[];
60
- /**
61
- * An array of built-in validations.
62
- */
63
- builtInValidations: BuiltInValidation[];
64
- /**
65
- * A validation handler instance to run validations before commands.
66
- */
67
- validationHandler?: ValidationHandler;
68
- }
69
- /**
70
- * Parameters for CommandKit's built-in validations.
71
- */
72
- interface BuiltInValidationParams {
73
- /**
74
- * The target command to validate.
75
- */
76
- targetCommand: CommandFileObject;
77
- /**
78
- * The interaction of the target command.
79
- */
80
- interaction: CommandKitInteraction;
81
- /**
82
- * The command handler's data.
83
- */
84
- handlerData: CommandHandlerData;
85
- }
86
- /**
87
- * Represents a command interaction.
88
- */
89
- type CommandKitInteraction = ChatInputCommandInteraction | ContextMenuCommandInteraction | AutocompleteInteraction;
90
- /**
91
- * A built in validation. Returns a boolean or void.
92
- */
93
- type BuiltInValidation = ({}: BuiltInValidationParams) => boolean | void;
94
-
95
- interface hCommandContext {
96
- interaction: CommandKitInteraction;
97
- command: CommandData;
98
- }
99
- /**
100
- * A handler for client application commands.
101
- */
102
- declare class CommandHandler {
103
- #private;
104
- context: AsyncLocalStorage<hCommandContext> | null;
105
- constructor({ ...options }: CommandHandlerOptions);
106
- init(): Promise<void>;
107
- handleCommands(): void;
108
- get commands(): CommandFileObject[];
109
- reloadCommands(type?: ReloadOptions): Promise<void>;
110
- }
111
-
112
- /**
113
- * Event handler options.
114
- */
115
- interface EventHandlerOptions {
116
- client: Client;
117
- eventsPath: string;
118
- commandKitInstance: CommandKit;
119
- }
120
- /**
121
- * Private event handler data.
122
- */
123
- interface EventHandlerData extends EventHandlerOptions {
124
- events: {
125
- name: string;
126
- functions: Function[];
127
- }[];
128
- }
129
-
130
- /**
131
- * A handler for client events.
132
- */
133
- declare class EventHandler {
134
- #private;
135
- constructor({ ...options }: EventHandlerOptions);
136
- init(): Promise<void>;
137
- get events(): {
138
- name: string;
139
- functions: Function[];
140
- }[];
141
- reloadEvents(commandHandler?: CommandHandler): Promise<void>;
142
- }
3
+ import { Client, Interaction, CacheType, ChatInputCommandInteraction, ContextMenuCommandInteraction, UserContextMenuCommandInteraction, MessageContextMenuCommandInteraction, AutocompleteInteraction, PermissionsString, RESTPostAPIApplicationCommandsJSONBody } from 'discord.js';
143
4
 
144
5
  /**
145
6
  * Options for instantiating a CommandKit handler.
@@ -181,15 +42,6 @@ interface CommandKitOptions {
181
42
  * Bulk register application commands instead of one-by-one.
182
43
  */
183
44
  bulkRegister?: boolean;
184
- /**
185
- * Options for experimental features.
186
- */
187
- experimental?: {
188
- /**
189
- * Enable hooks. This allows you to utilize hooks such as `useInteraction()` to access the interaction object anywhere inside the command.
190
- */
191
- hooks?: boolean;
192
- };
193
45
  }
194
46
  /**
195
47
  * Private data for the CommandKit class.
@@ -388,6 +240,139 @@ declare enum ReloadType {
388
240
  Global = "global"
389
241
  }
390
242
 
243
+ /**
244
+ * Command handler options.
245
+ * Similar to CommandKit options in structure.
246
+ */
247
+ interface CommandHandlerOptions {
248
+ /**
249
+ * The client created by the user.
250
+ */
251
+ client: Client;
252
+ /**
253
+ * Path to the user's commands.
254
+ */
255
+ commandsPath: string;
256
+ /**
257
+ * An array of developer guild IDs.
258
+ */
259
+ devGuildIds: string[];
260
+ /**
261
+ * An array of developer user IDs.
262
+ */
263
+ devUserIds: string[];
264
+ /**
265
+ * An array of developer role IDs.
266
+ */
267
+ devRoleIds: string[];
268
+ /**
269
+ * A validation handler instance to run validations before commands.
270
+ */
271
+ validationHandler?: ValidationHandler;
272
+ /**
273
+ * A boolean indicating whether to skip CommandKit's built-in validations (permission checking, etc.)
274
+ */
275
+ skipBuiltInValidations: boolean;
276
+ /**
277
+ * The CommandKit handler that instantiated this.
278
+ */
279
+ commandkitInstance: CommandKit;
280
+ /**
281
+ * A boolean indicating whether to register all commands in bulk.
282
+ */
283
+ bulkRegister: boolean;
284
+ }
285
+ /**
286
+ * Private command handler data.
287
+ */
288
+ interface CommandHandlerData extends CommandHandlerOptions {
289
+ /**
290
+ * An array of command file objects.
291
+ */
292
+ commands: CommandFileObject[];
293
+ /**
294
+ * An array of built-in validations.
295
+ */
296
+ builtInValidations: BuiltInValidation[];
297
+ /**
298
+ * A validation handler instance to run validations before commands.
299
+ */
300
+ validationHandler?: ValidationHandler;
301
+ }
302
+ /**
303
+ * Parameters for CommandKit's built-in validations.
304
+ */
305
+ interface BuiltInValidationParams {
306
+ /**
307
+ * The target command to validate.
308
+ */
309
+ targetCommand: CommandFileObject;
310
+ /**
311
+ * The interaction of the target command.
312
+ */
313
+ interaction: CommandKitInteraction;
314
+ /**
315
+ * The command handler's data.
316
+ */
317
+ handlerData: CommandHandlerData;
318
+ }
319
+ /**
320
+ * Represents a command interaction.
321
+ */
322
+ type CommandKitInteraction = ChatInputCommandInteraction | ContextMenuCommandInteraction | AutocompleteInteraction;
323
+ /**
324
+ * A built in validation. Returns a boolean or void.
325
+ */
326
+ type BuiltInValidation = ({}: BuiltInValidationParams) => boolean | void;
327
+
328
+ interface hCommandContext {
329
+ interaction: CommandKitInteraction;
330
+ command: CommandData;
331
+ }
332
+ /**
333
+ * A handler for client application commands.
334
+ */
335
+ declare class CommandHandler {
336
+ #private;
337
+ constructor({ ...options }: CommandHandlerOptions);
338
+ init(): Promise<void>;
339
+ handleCommands(): void;
340
+ get commands(): CommandFileObject[];
341
+ reloadCommands(type?: ReloadOptions): Promise<void>;
342
+ }
343
+
344
+ /**
345
+ * Event handler options.
346
+ */
347
+ interface EventHandlerOptions {
348
+ client: Client;
349
+ eventsPath: string;
350
+ commandKitInstance: CommandKit;
351
+ }
352
+ /**
353
+ * Private event handler data.
354
+ */
355
+ interface EventHandlerData extends EventHandlerOptions {
356
+ events: {
357
+ name: string;
358
+ functions: Function[];
359
+ }[];
360
+ }
361
+
362
+ /**
363
+ * A handler for client events.
364
+ */
365
+ declare class EventHandler {
366
+ #private;
367
+ constructor({ ...options }: EventHandlerOptions);
368
+ init(): Promise<void>;
369
+ get events(): {
370
+ name: string;
371
+ functions: Function[];
372
+ }[];
373
+ reloadEvents(commandHandler?: CommandHandler): Promise<void>;
374
+ }
375
+
391
376
  declare class CommandKit {
392
377
  #private;
393
378
  static _instance: CommandKit | null;
@@ -1,145 +1,6 @@
1
1
  import { ValidationHandler } from './handlers/validation-handler/ValidationHandler.js';
2
2
  import * as discord_js from 'discord.js';
3
- import { Client, ChatInputCommandInteraction, ContextMenuCommandInteraction, AutocompleteInteraction, Interaction, CacheType, UserContextMenuCommandInteraction, MessageContextMenuCommandInteraction, PermissionsString, RESTPostAPIApplicationCommandsJSONBody } from 'discord.js';
4
- import { AsyncLocalStorage } from 'async_hooks';
5
-
6
- /**
7
- * Command handler options.
8
- * Similar to CommandKit options in structure.
9
- */
10
- interface CommandHandlerOptions {
11
- /**
12
- * The client created by the user.
13
- */
14
- client: Client;
15
- /**
16
- * Path to the user's commands.
17
- */
18
- commandsPath: string;
19
- /**
20
- * An array of developer guild IDs.
21
- */
22
- devGuildIds: string[];
23
- /**
24
- * An array of developer user IDs.
25
- */
26
- devUserIds: string[];
27
- /**
28
- * An array of developer role IDs.
29
- */
30
- devRoleIds: string[];
31
- /**
32
- * A validation handler instance to run validations before commands.
33
- */
34
- validationHandler?: ValidationHandler;
35
- /**
36
- * A boolean indicating whether to skip CommandKit's built-in validations (permission checking, etc.)
37
- */
38
- skipBuiltInValidations: boolean;
39
- /**
40
- * The CommandKit handler that instantiated this.
41
- */
42
- commandkitInstance: CommandKit;
43
- /**
44
- * A boolean indicating whether to register all commands in bulk.
45
- */
46
- bulkRegister: boolean;
47
- /**
48
- * Whether to enable hooks context.
49
- */
50
- enableHooks: boolean;
51
- }
52
- /**
53
- * Private command handler data.
54
- */
55
- interface CommandHandlerData extends CommandHandlerOptions {
56
- /**
57
- * An array of command file objects.
58
- */
59
- commands: CommandFileObject[];
60
- /**
61
- * An array of built-in validations.
62
- */
63
- builtInValidations: BuiltInValidation[];
64
- /**
65
- * A validation handler instance to run validations before commands.
66
- */
67
- validationHandler?: ValidationHandler;
68
- }
69
- /**
70
- * Parameters for CommandKit's built-in validations.
71
- */
72
- interface BuiltInValidationParams {
73
- /**
74
- * The target command to validate.
75
- */
76
- targetCommand: CommandFileObject;
77
- /**
78
- * The interaction of the target command.
79
- */
80
- interaction: CommandKitInteraction;
81
- /**
82
- * The command handler's data.
83
- */
84
- handlerData: CommandHandlerData;
85
- }
86
- /**
87
- * Represents a command interaction.
88
- */
89
- type CommandKitInteraction = ChatInputCommandInteraction | ContextMenuCommandInteraction | AutocompleteInteraction;
90
- /**
91
- * A built in validation. Returns a boolean or void.
92
- */
93
- type BuiltInValidation = ({}: BuiltInValidationParams) => boolean | void;
94
-
95
- interface hCommandContext {
96
- interaction: CommandKitInteraction;
97
- command: CommandData;
98
- }
99
- /**
100
- * A handler for client application commands.
101
- */
102
- declare class CommandHandler {
103
- #private;
104
- context: AsyncLocalStorage<hCommandContext> | null;
105
- constructor({ ...options }: CommandHandlerOptions);
106
- init(): Promise<void>;
107
- handleCommands(): void;
108
- get commands(): CommandFileObject[];
109
- reloadCommands(type?: ReloadOptions): Promise<void>;
110
- }
111
-
112
- /**
113
- * Event handler options.
114
- */
115
- interface EventHandlerOptions {
116
- client: Client;
117
- eventsPath: string;
118
- commandKitInstance: CommandKit;
119
- }
120
- /**
121
- * Private event handler data.
122
- */
123
- interface EventHandlerData extends EventHandlerOptions {
124
- events: {
125
- name: string;
126
- functions: Function[];
127
- }[];
128
- }
129
-
130
- /**
131
- * A handler for client events.
132
- */
133
- declare class EventHandler {
134
- #private;
135
- constructor({ ...options }: EventHandlerOptions);
136
- init(): Promise<void>;
137
- get events(): {
138
- name: string;
139
- functions: Function[];
140
- }[];
141
- reloadEvents(commandHandler?: CommandHandler): Promise<void>;
142
- }
3
+ import { Client, Interaction, CacheType, ChatInputCommandInteraction, ContextMenuCommandInteraction, UserContextMenuCommandInteraction, MessageContextMenuCommandInteraction, AutocompleteInteraction, PermissionsString, RESTPostAPIApplicationCommandsJSONBody } from 'discord.js';
143
4
 
144
5
  /**
145
6
  * Options for instantiating a CommandKit handler.
@@ -181,15 +42,6 @@ interface CommandKitOptions {
181
42
  * Bulk register application commands instead of one-by-one.
182
43
  */
183
44
  bulkRegister?: boolean;
184
- /**
185
- * Options for experimental features.
186
- */
187
- experimental?: {
188
- /**
189
- * Enable hooks. This allows you to utilize hooks such as `useInteraction()` to access the interaction object anywhere inside the command.
190
- */
191
- hooks?: boolean;
192
- };
193
45
  }
194
46
  /**
195
47
  * Private data for the CommandKit class.
@@ -388,6 +240,139 @@ declare enum ReloadType {
388
240
  Global = "global"
389
241
  }
390
242
 
243
+ /**
244
+ * Command handler options.
245
+ * Similar to CommandKit options in structure.
246
+ */
247
+ interface CommandHandlerOptions {
248
+ /**
249
+ * The client created by the user.
250
+ */
251
+ client: Client;
252
+ /**
253
+ * Path to the user's commands.
254
+ */
255
+ commandsPath: string;
256
+ /**
257
+ * An array of developer guild IDs.
258
+ */
259
+ devGuildIds: string[];
260
+ /**
261
+ * An array of developer user IDs.
262
+ */
263
+ devUserIds: string[];
264
+ /**
265
+ * An array of developer role IDs.
266
+ */
267
+ devRoleIds: string[];
268
+ /**
269
+ * A validation handler instance to run validations before commands.
270
+ */
271
+ validationHandler?: ValidationHandler;
272
+ /**
273
+ * A boolean indicating whether to skip CommandKit's built-in validations (permission checking, etc.)
274
+ */
275
+ skipBuiltInValidations: boolean;
276
+ /**
277
+ * The CommandKit handler that instantiated this.
278
+ */
279
+ commandkitInstance: CommandKit;
280
+ /**
281
+ * A boolean indicating whether to register all commands in bulk.
282
+ */
283
+ bulkRegister: boolean;
284
+ }
285
+ /**
286
+ * Private command handler data.
287
+ */
288
+ interface CommandHandlerData extends CommandHandlerOptions {
289
+ /**
290
+ * An array of command file objects.
291
+ */
292
+ commands: CommandFileObject[];
293
+ /**
294
+ * An array of built-in validations.
295
+ */
296
+ builtInValidations: BuiltInValidation[];
297
+ /**
298
+ * A validation handler instance to run validations before commands.
299
+ */
300
+ validationHandler?: ValidationHandler;
301
+ }
302
+ /**
303
+ * Parameters for CommandKit's built-in validations.
304
+ */
305
+ interface BuiltInValidationParams {
306
+ /**
307
+ * The target command to validate.
308
+ */
309
+ targetCommand: CommandFileObject;
310
+ /**
311
+ * The interaction of the target command.
312
+ */
313
+ interaction: CommandKitInteraction;
314
+ /**
315
+ * The command handler's data.
316
+ */
317
+ handlerData: CommandHandlerData;
318
+ }
319
+ /**
320
+ * Represents a command interaction.
321
+ */
322
+ type CommandKitInteraction = ChatInputCommandInteraction | ContextMenuCommandInteraction | AutocompleteInteraction;
323
+ /**
324
+ * A built in validation. Returns a boolean or void.
325
+ */
326
+ type BuiltInValidation = ({}: BuiltInValidationParams) => boolean | void;
327
+
328
+ interface hCommandContext {
329
+ interaction: CommandKitInteraction;
330
+ command: CommandData;
331
+ }
332
+ /**
333
+ * A handler for client application commands.
334
+ */
335
+ declare class CommandHandler {
336
+ #private;
337
+ constructor({ ...options }: CommandHandlerOptions);
338
+ init(): Promise<void>;
339
+ handleCommands(): void;
340
+ get commands(): CommandFileObject[];
341
+ reloadCommands(type?: ReloadOptions): Promise<void>;
342
+ }
343
+
344
+ /**
345
+ * Event handler options.
346
+ */
347
+ interface EventHandlerOptions {
348
+ client: Client;
349
+ eventsPath: string;
350
+ commandKitInstance: CommandKit;
351
+ }
352
+ /**
353
+ * Private event handler data.
354
+ */
355
+ interface EventHandlerData extends EventHandlerOptions {
356
+ events: {
357
+ name: string;
358
+ functions: Function[];
359
+ }[];
360
+ }
361
+
362
+ /**
363
+ * A handler for client events.
364
+ */
365
+ declare class EventHandler {
366
+ #private;
367
+ constructor({ ...options }: EventHandlerOptions);
368
+ init(): Promise<void>;
369
+ get events(): {
370
+ name: string;
371
+ functions: Function[];
372
+ }[];
373
+ reloadEvents(commandHandler?: CommandHandler): Promise<void>;
374
+ }
375
+
391
376
  declare class CommandKit {
392
377
  #private;
393
378
  static _instance: CommandKit | null;
@@ -1,5 +1,4 @@
1
1
  import 'discord.js';
2
- export { C as CommandKit } from './CommandKit-D84HlsL0.mjs';
2
+ export { C as CommandKit } from './CommandKit-DV84yztA.mjs';
3
3
  import './handlers/validation-handler/ValidationHandler.mjs';
4
4
  import './handlers/validation-handler/typings.mjs';
5
- import 'async_hooks';
@@ -1,5 +1,4 @@
1
1
  import 'discord.js';
2
- export { C as CommandKit } from './CommandKit-Co5QNlps.js';
2
+ export { C as CommandKit } from './CommandKit-pPD1Tn9T.js';
3
3
  import './handlers/validation-handler/ValidationHandler.js';
4
4
  import './handlers/validation-handler/typings.js';
5
- import 'async_hooks';