commandkit 0.1.10-dev.20231229085439 → 0.1.10-dev.20240108063947

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.
package/dist/index.mjs CHANGED
@@ -93,7 +93,7 @@ async function loadCommandsWithRest(props) {
93
93
  props.type
94
94
  );
95
95
  } else {
96
- throw new Error(colors_default.red(`\u274C Cannot reload commands when client is not ready.`));
96
+ throw new Error(colors_default.red(`Cannot reload commands when client is not ready.`));
97
97
  }
98
98
  } else {
99
99
  props.client.once("ready", async (c) => {
@@ -117,18 +117,16 @@ async function handleLoading(client, commands, devGuildIds, reloading, type) {
117
117
  async function loadGlobalCommands(client, commands, reloading) {
118
118
  const requestBody = commands.map((cmd) => cmd.data);
119
119
  await client.application.commands.set(requestBody).catch((error) => {
120
- console.log(
120
+ throw new Error(
121
121
  colors_default.red(
122
- `\u274C Error ${reloading ? "reloading" : "loading"} global application commands.
122
+ `Error ${reloading ? "reloading" : "loading"} global application commands.
123
123
  `
124
- )
124
+ ),
125
+ error
125
126
  );
126
- throw new Error(error);
127
127
  });
128
128
  console.log(
129
- colors_default.green(
130
- `\u2705 ${reloading ? "Reloaded" : "Loaded"} ${requestBody.length} global commands.`
131
- )
129
+ colors_default.green(`${reloading ? "Reloaded" : "Loaded"} ${requestBody.length} global commands.`)
132
130
  );
133
131
  }
134
132
  async function loadDevCommands(client, commands, guildIds, reloading) {
@@ -136,23 +134,23 @@ async function loadDevCommands(client, commands, guildIds, reloading) {
136
134
  for (const guildId of guildIds) {
137
135
  const targetGuild = client.guilds.cache.get(guildId) || await client.guilds.fetch(guildId);
138
136
  if (!targetGuild) {
139
- console.log(
140
- `Couldn't ${reloading ? "reloading" : "loading"} commands in guild "${targetGuild}" - guild doesn't exist or client isn't part of the guild.`
137
+ process.emitWarning(
138
+ `Cannot ${reloading ? "reload" : "load"} commands in guild "${guildId}" - guild doesn't exist or client isn't part of the guild.`
141
139
  );
142
140
  continue;
143
141
  }
144
142
  await targetGuild.commands.set(requestBody).catch((error) => {
145
- console.log(
143
+ throw new Error(
146
144
  colors_default.red(
147
- `\u274C Error ${reloading ? "reloading" : "loading"} developer application commands in guild "${targetGuild?.name || guildId}".
145
+ `Error ${reloading ? "reloading" : "loading"} developer application commands in guild "${targetGuild?.name || guildId}".
148
146
  `
149
- )
147
+ ),
148
+ error
150
149
  );
151
- throw new Error(error);
152
150
  });
153
151
  console.log(
154
152
  colors_default.green(
155
- `\u2705 ${reloading ? "Reloaded" : "Loaded"} ${requestBody.length} developer commands in guild "${targetGuild.name}".`
153
+ `${reloading ? "Reloaded" : "Loaded"} ${requestBody.length} developer commands in guild "${targetGuild.name}".`
156
154
  )
157
155
  );
158
156
  }
@@ -179,7 +177,7 @@ async function registerCommands(props) {
179
177
  if (props.client.isReady()) {
180
178
  await handleRegistration(props.client, props.commands, props.devGuildIds, props.type);
181
179
  } else {
182
- throw new Error(colors_default.red(`\u274C Cannot reload commands when client is not ready.`));
180
+ throw new Error(colors_default.red(`Cannot reload commands when client is not ready.`));
183
181
  }
184
182
  } else {
185
183
  props.client.once("ready", async (c) => {
@@ -208,19 +206,20 @@ async function registerGlobalCommands(client, commands) {
208
206
  );
209
207
  if (command.options?.deleted) {
210
208
  if (!targetCommand) {
211
- console.log(
209
+ process.emitWarning(
212
210
  colors_default.yellow(
213
- `\u23E9 Ignoring: Command "${command.data.name}" is globally marked as deleted.`
211
+ `Ignoring: Command "${command.data.name}" is globally marked as deleted.`
214
212
  )
215
213
  );
216
214
  } else {
217
215
  await targetCommand.delete().catch((error) => {
218
- console.log(
219
- colors_default.red(`\u274C Failed to delete command "${command.data.name}" globally.`)
216
+ throw new Error(
217
+ colors_default.red(`Failed to delete command "${command.data.name}" globally.
218
+ `),
219
+ error
220
220
  );
221
- console.error(error);
222
221
  });
223
- console.log(colors_default.green(`\u{1F6AE} Deleted command "${command.data.name}" globally.`));
222
+ console.log(colors_default.green(`Deleted command "${command.data.name}" globally.`));
224
223
  }
225
224
  continue;
226
225
  }
@@ -228,26 +227,26 @@ async function registerGlobalCommands(client, commands) {
228
227
  const commandsAreDifferent = areSlashCommandsDifferent(targetCommand, command.data);
229
228
  if (commandsAreDifferent) {
230
229
  await targetCommand.edit(command.data).catch((error) => {
231
- console.log(
232
- colors_default.red(
233
- `\u274C Failed to edit command "${command.data.name}" globally.`
234
- )
230
+ throw new Error(
231
+ colors_default.red(`Failed to edit command "${command.data.name}" globally.
232
+ `),
233
+ error
235
234
  );
236
- console.error(error);
237
235
  });
238
- console.log(colors_default.green(`\u2705 Edited command "${command.data.name}" globally.`));
236
+ console.log(colors_default.green(`Edited command "${command.data.name}" globally.`));
239
237
  continue;
240
238
  }
241
239
  }
242
240
  if (targetCommand)
243
241
  continue;
244
242
  await appCommandsManager.create(command.data).catch((error) => {
245
- console.log(
246
- colors_default.red(`\u274C Failed to register command "${command.data.name}" globally.`)
243
+ throw new Error(
244
+ colors_default.red(`Failed to register command "${command.data.name}" globally.
245
+ `),
246
+ error
247
247
  );
248
- console.error(error);
249
248
  });
250
- console.log(colors_default.green(`\u2705 Registered command "${command.data.name}" globally.`));
249
+ console.log(colors_default.green(`Registered command "${command.data.name}" globally.`));
251
250
  }
252
251
  }
253
252
  async function registerDevCommands(client, commands, guildIds) {
@@ -255,9 +254,9 @@ async function registerDevCommands(client, commands, guildIds) {
255
254
  for (const guildId of guildIds) {
256
255
  const guild = client.guilds.cache.get(guildId) || await client.guilds.fetch(guildId);
257
256
  if (!guild) {
258
- console.log(
257
+ process.emitWarning(
259
258
  colors_default.yellow(
260
- `\u23E9 Ignoring: Guild ${guildId} does not exist or client isn't in this guild.`
259
+ `Ignoring: Guild ${guildId} doesn't exist or client isn't part of the guild.`
261
260
  )
262
261
  );
263
262
  continue;
@@ -275,23 +274,23 @@ async function registerDevCommands(client, commands, guildIds) {
275
274
  const targetCommand = guildCommands.cache.find((cmd) => cmd.name === command.data.name);
276
275
  if (command.options?.deleted) {
277
276
  if (!targetCommand) {
278
- console.log(
277
+ process.emitWarning(
279
278
  colors_default.yellow(
280
- `\u23E9 Ignoring: Command "${command.data.name}" is marked as deleted for ${guildCommands.guild.name}.`
279
+ `Ignoring: Command "${command.data.name}" is marked as deleted in ${guildCommands.guild.name}.`
281
280
  )
282
281
  );
283
282
  } else {
284
283
  await targetCommand.delete().catch((error) => {
285
- console.log(
284
+ throw new Error(
286
285
  colors_default.red(
287
- `\u274C Failed to delete command "${command.data.name}" in ${guildCommands.guild.name}.`
288
- )
286
+ `Failed to delete command "${command.data.name}" in ${guildCommands.guild.name}.`
287
+ ),
288
+ error
289
289
  );
290
- console.error(error);
291
290
  });
292
291
  console.log(
293
292
  colors_default.green(
294
- `\u{1F6AE} Deleted command "${command.data.name}" in ${guildCommands.guild.name}.`
293
+ `Deleted command "${command.data.name}" in ${guildCommands.guild.name}.`
295
294
  )
296
295
  );
297
296
  }
@@ -301,16 +300,17 @@ async function registerDevCommands(client, commands, guildIds) {
301
300
  const commandsAreDifferent = areSlashCommandsDifferent(targetCommand, command.data);
302
301
  if (commandsAreDifferent) {
303
302
  await targetCommand.edit(command.data).catch((error) => {
304
- console.log(
303
+ throw new Error(
305
304
  colors_default.red(
306
- `\u274C Failed to edit command "${command.data.name}" in ${guildCommands.guild.name}.`
307
- )
305
+ `Failed to edit command "${command.data.name}" in ${guildCommands.guild.name}.
306
+ `
307
+ ),
308
+ error
308
309
  );
309
- console.error(error);
310
310
  });
311
311
  console.log(
312
312
  colors_default.green(
313
- `\u2705 Edited command "${command.data.name}" in ${guildCommands.guild.name}.`
313
+ `Edited command "${command.data.name}" in ${guildCommands.guild.name}.`
314
314
  )
315
315
  );
316
316
  continue;
@@ -319,16 +319,17 @@ async function registerDevCommands(client, commands, guildIds) {
319
319
  if (targetCommand)
320
320
  continue;
321
321
  await guildCommands.create(command.data).catch((error) => {
322
- console.log(
322
+ throw new Error(
323
323
  colors_default.red(
324
- `\u274C Failed to register command "${command.data.name}" in ${guildCommands.guild.name}.`
325
- )
324
+ `Failed to register command "${command.data.name}" in ${guildCommands.guild.name}.
325
+ `
326
+ ),
327
+ error
326
328
  );
327
- console.error(error);
328
329
  });
329
330
  console.log(
330
331
  colors_default.green(
331
- `\u2705 Registered command "${command.data.name}" in ${guildCommands.guild.name}.`
332
+ `Registered command "${command.data.name}" in ${guildCommands.guild.name}.`
332
333
  )
333
334
  );
334
335
  }
@@ -436,8 +437,10 @@ function permissions_default({ interaction, targetCommand }) {
436
437
  var validations_default = [devOnly_default, permissions_default];
437
438
 
438
439
  // src/handlers/command-handler/CommandHandler.ts
440
+ import { AsyncLocalStorage } from "async_hooks";
439
441
  var CommandHandler = class {
440
442
  #data;
443
+ context = null;
441
444
  constructor({ ...options }) {
442
445
  this.#data = {
443
446
  ...options,
@@ -446,20 +449,23 @@ var CommandHandler = class {
446
449
  };
447
450
  }
448
451
  async init() {
452
+ if (this.#data.enableHooks && !this.context) {
453
+ this.context = new AsyncLocalStorage();
454
+ }
449
455
  await this.#buildCommands();
450
456
  this.#buildBuiltInValidations();
451
457
  const devOnlyCommands = this.#data.commands.filter((cmd) => cmd.options?.devOnly);
452
458
  if (devOnlyCommands.length && !this.#data.devGuildIds.length) {
453
- console.log(
459
+ process.emitWarning(
454
460
  colors_default.yellow(
455
- '\u2139\uFE0F Warning: You have commands marked as "devOnly", but "devGuildIds" have not been set.'
461
+ 'You have commands marked as "devOnly", but "devGuildIds" have not been set.'
456
462
  )
457
463
  );
458
464
  }
459
465
  if (devOnlyCommands.length && !this.#data.devUserIds.length && !this.#data.devRoleIds.length) {
460
- console.log(
466
+ process.emitWarning(
461
467
  colors_default.yellow(
462
- '\u2139\uFE0F Warning: You have commands marked as "devOnly", but "devUserIds" or "devRoleIds" have not been set.'
468
+ 'You have commands marked as "devOnly", but "devUserIds" or "devRoleIds" have not been set.'
463
469
  )
464
470
  );
465
471
  }
@@ -498,33 +504,33 @@ var CommandHandler = class {
498
504
  commandObj.data = importedObj.data;
499
505
  }
500
506
  if (!commandObj.data) {
501
- console.log(
507
+ process.emitWarning(
502
508
  colors_default.yellow(
503
- `\u23E9 Ignoring: Command ${compactFilePath} does not export "data".`
509
+ `Ignoring: Command file ${compactFilePath} does not export "data".`
504
510
  )
505
511
  );
506
512
  continue;
507
513
  }
508
514
  if (!commandObj.data.name) {
509
- console.log(
515
+ process.emitWarning(
510
516
  colors_default.yellow(
511
- `\u23E9 Ignoring: Command ${compactFilePath} does not export "data.name".`
517
+ `Ignoring: Command file ${compactFilePath} does not export "data.name".`
512
518
  )
513
519
  );
514
520
  continue;
515
521
  }
516
522
  if (!commandObj.run) {
517
- console.log(
523
+ process.emitWarning(
518
524
  colors_default.yellow(
519
- `\u23E9 Ignoring: Command ${commandObj.data.name} does not export "run".`
525
+ `Ignoring: Command file ${commandObj.data.name} does not export "run".`
520
526
  )
521
527
  );
522
528
  continue;
523
529
  }
524
530
  if (typeof commandObj.run !== "function") {
525
- console.log(
531
+ process.emitWarning(
526
532
  colors_default.yellow(
527
- `\u23E9 Ignoring: Command ${commandObj.data.name} does not export "run" as a function.`
533
+ `Ignoring: Command file ${commandObj.data.name} does not export "run" as a function.`
528
534
  )
529
535
  );
530
536
  continue;
@@ -545,6 +551,7 @@ var CommandHandler = class {
545
551
  }
546
552
  }
547
553
  handleCommands() {
554
+ const areHooksEnabled = this.#data.enableHooks;
548
555
  this.#data.client.on("interactionCreate", async (interaction) => {
549
556
  if (!interaction.isChatInputCommand() && !interaction.isContextMenuCommand() && !interaction.isAutocomplete())
550
557
  return;
@@ -557,50 +564,65 @@ var CommandHandler = class {
557
564
  const { data, options, run, autocomplete, ...rest } = targetCommand;
558
565
  if (isAutocomplete && !autocomplete)
559
566
  return;
560
- const commandObj = {
561
- data: targetCommand.data,
562
- options: targetCommand.options,
563
- ...rest
564
- };
565
- if (this.#data.validationHandler) {
566
- let canRun2 = true;
567
- for (const validationFunction of this.#data.validationHandler.validations) {
568
- const stopValidationLoop = await validationFunction({
569
- interaction,
570
- commandObj,
571
- client: this.#data.client,
572
- handler: this.#data.commandkitInstance
573
- });
574
- if (stopValidationLoop) {
575
- canRun2 = false;
576
- break;
567
+ const executor = async () => {
568
+ const commandObj = {
569
+ data: targetCommand.data,
570
+ options: targetCommand.options,
571
+ ...rest
572
+ };
573
+ if (this.#data.validationHandler) {
574
+ let canRun2 = true;
575
+ for (const validationFunction of this.#data.validationHandler.validations) {
576
+ const stopValidationLoop = await validationFunction({
577
+ interaction,
578
+ commandObj,
579
+ client: this.#data.client,
580
+ handler: this.#data.commandkitInstance
581
+ });
582
+ if (stopValidationLoop) {
583
+ canRun2 = false;
584
+ break;
585
+ }
577
586
  }
587
+ if (!canRun2)
588
+ return;
578
589
  }
579
- if (!canRun2)
590
+ let canRun = true;
591
+ if (!this.#data.skipBuiltInValidations) {
592
+ for (const validation of this.#data.builtInValidations) {
593
+ const stopValidationLoop = validation({
594
+ targetCommand,
595
+ interaction,
596
+ handlerData: this.#data
597
+ });
598
+ if (stopValidationLoop) {
599
+ canRun = false;
600
+ break;
601
+ }
602
+ }
603
+ }
604
+ if (!canRun)
580
605
  return;
581
- }
582
- let canRun = true;
583
- if (!this.#data.skipBuiltInValidations) {
584
- for (const validation of this.#data.builtInValidations) {
585
- const stopValidationLoop = validation({
586
- targetCommand,
606
+ const command = targetCommand[isAutocomplete ? "autocomplete" : "run"];
607
+ if (!areHooksEnabled) {
608
+ const context2 = {
587
609
  interaction,
588
- handlerData: this.#data
589
- });
590
- if (stopValidationLoop) {
591
- canRun = false;
592
- break;
593
- }
610
+ client: this.#data.client,
611
+ handler: this.#data.commandkitInstance
612
+ };
613
+ return await command(context2);
594
614
  }
595
- }
596
- if (!canRun)
597
- return;
598
- const context2 = {
599
- interaction,
600
- client: this.#data.client,
601
- handler: this.#data.commandkitInstance
615
+ return command();
602
616
  };
603
- await targetCommand[isAutocomplete ? "autocomplete" : "run"](context2);
617
+ if (this.context)
618
+ return this.context.run(
619
+ {
620
+ command: targetCommand.data,
621
+ interaction
622
+ },
623
+ executor
624
+ );
625
+ return executor();
604
626
  });
605
627
  }
606
628
  get commands() {
@@ -609,7 +631,9 @@ var CommandHandler = class {
609
631
  async reloadCommands(type) {
610
632
  if (!this.#data.commandsPath) {
611
633
  throw new Error(
612
- 'Cannot reload commands as "commandsPath" was not provided when instantiating CommandKit.'
634
+ colors_default.red(
635
+ 'Cannot reload commands as "commandsPath" was not provided when instantiating CommandKit.'
636
+ )
613
637
  );
614
638
  }
615
639
  this.#data.commands = [];
@@ -671,9 +695,9 @@ var EventHandler = class {
671
695
  }
672
696
  const compactFilePath = eventFilePath.split(process.cwd())[1] || eventFilePath;
673
697
  if (typeof eventFunction !== "function") {
674
- console.log(
698
+ process.emitWarning(
675
699
  colors_default.yellow(
676
- `\u23E9 Ignoring: Event ${compactFilePath} does not export a function.`
700
+ `Ignoring: Event file ${compactFilePath} does not export a function.`
677
701
  )
678
702
  );
679
703
  continue;
@@ -702,7 +726,9 @@ var EventHandler = class {
702
726
  async reloadEvents(commandHandler) {
703
727
  if (!this.#data.eventsPath) {
704
728
  throw new Error(
705
- 'Cannot reload events as "eventsPath" was not provided when instantiating CommandKit.'
729
+ colors_default.red(
730
+ 'Cannot reload events as "eventsPath" was not provided when instantiating CommandKit.'
731
+ )
706
732
  );
707
733
  }
708
734
  this.#data.events = [];
@@ -742,9 +768,9 @@ var ValidationHandler = class {
742
768
  }
743
769
  const compactFilePath = validationFilePath.split(process.cwd())[1] || validationFilePath;
744
770
  if (typeof validationFunction !== "function") {
745
- console.log(
771
+ process.emitWarning(
746
772
  colors_default.yellow(
747
- `\u23E9 Ignoring: Validation ${compactFilePath} does not export a function.`
773
+ `Ignoring: Validation file ${compactFilePath} does not export a function.`
748
774
  )
749
775
  );
750
776
  continue;
@@ -759,7 +785,9 @@ var ValidationHandler = class {
759
785
  async reloadValidations() {
760
786
  if (!this.#data.validationsPath) {
761
787
  throw new Error(
762
- 'Cannot reload validations as "validationsPath" was not provided when instantiating CommandKit.'
788
+ colors_default.red(
789
+ 'Cannot reload validations as "validationsPath" was not provided when instantiating CommandKit.'
790
+ )
763
791
  );
764
792
  }
765
793
  const newValidations = await this.#buildValidations();
@@ -768,8 +796,9 @@ var ValidationHandler = class {
768
796
  };
769
797
 
770
798
  // src/CommandKit.ts
771
- var CommandKit = class {
799
+ var CommandKit = class _CommandKit {
772
800
  #data;
801
+ static _instance = null;
773
802
  /**
774
803
  * Create a new command and event handler with CommandKit.
775
804
  *
@@ -786,8 +815,21 @@ var CommandKit = class {
786
815
  );
787
816
  }
788
817
  this.#data = options;
818
+ _CommandKit._instance = this;
789
819
  this.#init();
790
820
  }
821
+ /**
822
+ * Get the client attached to this CommandKit instance.
823
+ */
824
+ get client() {
825
+ return this.#data.client;
826
+ }
827
+ /**
828
+ * Get command handler instance.
829
+ */
830
+ get commandHandler() {
831
+ return this.#data.commandHandler;
832
+ }
791
833
  /**
792
834
  * (Private) Initialize CommandKit.
793
835
  */
@@ -818,7 +860,8 @@ var CommandKit = class {
818
860
  validationHandler: this.#data.validationHandler,
819
861
  skipBuiltInValidations: this.#data.skipBuiltInValidations || false,
820
862
  commandkitInstance: this,
821
- bulkRegister: this.#data.bulkRegister || false
863
+ bulkRegister: this.#data.bulkRegister || false,
864
+ enableHooks: this.#data.experimental?.hooks ?? false
822
865
  });
823
866
  await commandHandler.init();
824
867
  this.#data.commandHandler = commandHandler;
@@ -1075,11 +1118,117 @@ function createEffect(callback) {
1075
1118
  function getCurrentObserver() {
1076
1119
  return context[context.length - 1];
1077
1120
  }
1121
+
1122
+ // src/hooks/common.ts
1123
+ function getCommandKit() {
1124
+ return CommandKit._instance;
1125
+ }
1126
+ function getCommandHandler() {
1127
+ const handler = getCommandKit()?.commandHandler;
1128
+ if (!handler) {
1129
+ throw new Error("CommandKit is not initialized.");
1130
+ }
1131
+ return handler;
1132
+ }
1133
+ function getContext() {
1134
+ const info = getCommandHandler().context;
1135
+ if (!info) {
1136
+ throw new Error("Context is not available, did you forget to enable hooks?");
1137
+ }
1138
+ return info;
1139
+ }
1140
+ function prepareHookInvocationError(name) {
1141
+ return new Error(`Cannot invoke hook "${name}" outside of a command.`);
1142
+ }
1143
+
1144
+ // src/hooks/useCommandKit.ts
1145
+ function useCommandKit() {
1146
+ const kit = getCommandKit();
1147
+ if (!kit)
1148
+ throw new Error("CommandKit is not initialized.");
1149
+ return kit;
1150
+ }
1151
+
1152
+ // src/hooks/useClient.ts
1153
+ function useClient() {
1154
+ return useCommandKit().client;
1155
+ }
1156
+
1157
+ // src/hooks/useInteraction.ts
1158
+ function useInteraction() {
1159
+ const data = getContext().getStore();
1160
+ if (!data)
1161
+ throw prepareHookInvocationError("useInteraction");
1162
+ return data.interaction;
1163
+ }
1164
+
1165
+ // src/hooks/response.ts
1166
+ async function response(data) {
1167
+ const interaction = useInteraction();
1168
+ if (interaction.isAutocomplete())
1169
+ return;
1170
+ if (interaction.replied || interaction.deferred) {
1171
+ await interaction.editReply(data);
1172
+ } else if (interaction.isMessageComponent()) {
1173
+ await interaction.update(data);
1174
+ } else {
1175
+ await interaction.reply(data);
1176
+ }
1177
+ }
1178
+
1179
+ // src/hooks/useChannel.ts
1180
+ function useChannel() {
1181
+ const data = getContext().getStore();
1182
+ if (!data)
1183
+ throw prepareHookInvocationError("useChannel");
1184
+ return data.interaction.channel;
1185
+ }
1186
+
1187
+ // src/hooks/useCommandData.ts
1188
+ function useCommandData() {
1189
+ const data = getContext().getStore();
1190
+ if (!data)
1191
+ throw prepareHookInvocationError("useCommandData");
1192
+ return data.command;
1193
+ }
1194
+
1195
+ // src/hooks/useGuild.ts
1196
+ function useGuild() {
1197
+ const data = getContext().getStore();
1198
+ if (!data)
1199
+ throw prepareHookInvocationError("useGuild");
1200
+ return data.interaction.guild;
1201
+ }
1202
+
1203
+ // src/hooks/useMember.ts
1204
+ function useMember() {
1205
+ const data = getContext().getStore();
1206
+ if (!data)
1207
+ throw prepareHookInvocationError("useMember");
1208
+ return data.interaction.member;
1209
+ }
1210
+
1211
+ // src/hooks/useUser.ts
1212
+ function useUser() {
1213
+ const data = getContext().getStore();
1214
+ if (!data)
1215
+ throw prepareHookInvocationError("useUser");
1216
+ return data.interaction.user;
1217
+ }
1078
1218
  export {
1079
1219
  ButtonKit,
1080
1220
  CommandKit,
1081
1221
  createEffect,
1082
1222
  createSignal,
1083
1223
  defineConfig,
1084
- getConfig
1224
+ getConfig,
1225
+ response,
1226
+ useChannel,
1227
+ useClient,
1228
+ useCommandData,
1229
+ useCommandKit,
1230
+ useGuild,
1231
+ useInteraction,
1232
+ useMember,
1233
+ useUser
1085
1234
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "commandkit",
3
3
  "description": "Beginner friendly command & event handler for Discord.js",
4
- "version": "0.1.10-dev.20231229085439",
4
+ "version": "0.1.10-dev.20240108063947",
5
5
  "license": "MIT",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.mjs",