honocord 1.2.2 → 1.2.3
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.d.mts +38 -22
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +67 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as discord_api_types_v100 from "discord-api-types/v10";
|
|
2
2
|
import { APIApplicationCommandAutocompleteInteraction, APIApplicationCommandInteraction, APIApplicationCommandInteractionDataOption, APIApplicationCommandOptionChoice, APIAttachment, APIChatInputApplicationCommandInteraction, APIChatInputApplicationCommandInteraction as APIChatInputApplicationCommandInteraction$1, APIEmbed, APIInteraction, APIInteraction as APIInteraction$1, APIInteractionDataResolved, APIInteractionDataResolvedChannel, APIInteractionDataResolvedGuildMember, APIInteractionResponseCallbackData, APILabelComponent, APIMessage, APIMessageApplicationCommandInteraction, APIMessageButtonInteractionData, APIMessageChannelSelectInteractionData, APIMessageComponentInteraction, APIMessageMentionableSelectInteractionData, APIMessageRoleSelectInteractionData, APIMessageStringSelectInteractionData, APIMessageTopLevelComponent, APIMessageUserSelectInteractionData, APIModalInteractionResponseCallbackData, APIModalSubmitInteraction, APIModalSubmitInteraction as APIModalSubmitInteraction$1, APIPartialInteractionGuild, APIPingInteraction, APIRole, APIUser, APIUserApplicationCommandInteraction, ApplicationCommandOptionType, ApplicationCommandType, ApplicationCommandType as ApplicationCommandType$1, ChannelType, ChannelType as ChannelType$1, ComponentType, ComponentType as ComponentType$1, InteractionResponseType, InteractionType, InteractionType as InteractionType$1, Locale, ModalSubmitLabelComponent, ModalSubmitTextDisplayComponent, Snowflake, Snowflake as Snowflake$1 } from "discord-api-types/v10";
|
|
3
3
|
import { Collection, Collection as Collection$1, ReadonlyCollection, ReadonlyCollection as ReadonlyCollection$1 } from "@discordjs/collection";
|
|
4
4
|
import { ActionRowBuilder, ButtonBuilder, ChannelSelectMenuBuilder, ContainerBuilder, ContextMenuCommandBuilder, EmbedBuilder, FileBuilder, FileUploadBuilder, LabelBuilder, MediaGalleryBuilder, MediaGalleryItemBuilder, MentionableSelectMenuBuilder, ModalBuilder, ModalBuilder as ModalBuilder$1, RoleSelectMenuBuilder, SectionBuilder, SelectMenuOptionBuilder, SeparatorBuilder, SlashCommandAttachmentOption, SlashCommandBooleanOption, SlashCommandBuilder, SlashCommandChannelOption, SlashCommandIntegerOption, SlashCommandMentionableOption, SlashCommandNumberOption, SlashCommandRoleOption, SlashCommandStringOption, SlashCommandSubcommandBuilder, SlashCommandSubcommandBuilder as SlashCommandSubcommandBuilder$1, SlashCommandSubcommandGroupBuilder, SlashCommandSubcommandGroupBuilder as SlashCommandSubcommandGroupBuilder$1, SlashCommandUserOption, StringSelectMenuBuilder, StringSelectMenuOptionBuilder, TextDisplayBuilder, TextInputBuilder, ThumbnailBuilder, UserSelectMenuBuilder } from "@discordjs/builders";
|
|
@@ -58,27 +58,27 @@ declare class CommandInteractionOptionResolver {
|
|
|
58
58
|
* @param required Whether to throw an error if the option is not found.
|
|
59
59
|
* @returns The option, if found.
|
|
60
60
|
*/
|
|
61
|
-
get<T extends ApplicationCommandOptionType>(name: string, type: T, required?: boolean): Extract<
|
|
61
|
+
get<T extends ApplicationCommandOptionType>(name: string, type: T, required?: boolean): Extract<discord_api_types_v100.APIApplicationCommandInteractionDataAttachmentOption, {
|
|
62
62
|
type: T;
|
|
63
|
-
}> | Extract<
|
|
63
|
+
}> | Extract<discord_api_types_v100.APIApplicationCommandInteractionDataBooleanOption, {
|
|
64
64
|
type: T;
|
|
65
|
-
}> | Extract<
|
|
65
|
+
}> | Extract<discord_api_types_v100.APIApplicationCommandInteractionDataChannelOption, {
|
|
66
66
|
type: T;
|
|
67
|
-
}> | Extract<
|
|
67
|
+
}> | Extract<discord_api_types_v100.APIApplicationCommandInteractionDataMentionableOption, {
|
|
68
68
|
type: T;
|
|
69
|
-
}> | Extract<
|
|
69
|
+
}> | Extract<discord_api_types_v100.APIApplicationCommandInteractionDataRoleOption, {
|
|
70
70
|
type: T;
|
|
71
|
-
}> | Extract<
|
|
71
|
+
}> | Extract<discord_api_types_v100.APIApplicationCommandInteractionDataStringOption, {
|
|
72
72
|
type: T;
|
|
73
|
-
}> | Extract<
|
|
73
|
+
}> | Extract<discord_api_types_v100.APIApplicationCommandInteractionDataUserOption, {
|
|
74
74
|
type: T;
|
|
75
|
-
}> | Extract<
|
|
75
|
+
}> | Extract<discord_api_types_v100.APIApplicationCommandInteractionDataIntegerOption<InteractionType$1.ApplicationCommand>, {
|
|
76
76
|
type: T;
|
|
77
|
-
}> | Extract<
|
|
77
|
+
}> | Extract<discord_api_types_v100.APIApplicationCommandInteractionDataNumberOption<InteractionType$1.ApplicationCommand>, {
|
|
78
78
|
type: T;
|
|
79
|
-
}> | Extract<
|
|
79
|
+
}> | Extract<discord_api_types_v100.APIApplicationCommandInteractionDataSubcommandGroupOption<InteractionType$1.ApplicationCommand>, {
|
|
80
80
|
type: T;
|
|
81
|
-
}> | Extract<
|
|
81
|
+
}> | Extract<discord_api_types_v100.APIApplicationCommandInteractionDataSubcommandOption<InteractionType$1.ApplicationCommand>, {
|
|
82
82
|
type: T;
|
|
83
83
|
}> | null;
|
|
84
84
|
/**
|
|
@@ -357,14 +357,14 @@ declare abstract class BaseInteraction<Type extends InteractionType$1, Context$1
|
|
|
357
357
|
type: Type;
|
|
358
358
|
}>, context: Context$1);
|
|
359
359
|
get applicationId(): string;
|
|
360
|
-
get entitlements():
|
|
360
|
+
get entitlements(): discord_api_types_v100.APIEntitlement[];
|
|
361
361
|
get channelId(): string | undefined;
|
|
362
|
-
get channel(): (Partial<
|
|
362
|
+
get channel(): (Partial<discord_api_types_v100.APIAnnouncementThreadChannel> & Pick<discord_api_types_v100.APIChannel, "type" | "id">) | (Partial<discord_api_types_v100.APIDMChannel> & Pick<discord_api_types_v100.APIChannel, "type" | "id">) | (Partial<discord_api_types_v100.APIGroupDMChannel> & Pick<discord_api_types_v100.APIChannel, "type" | "id">) | (Partial<discord_api_types_v100.APIGuildCategoryChannel> & Pick<discord_api_types_v100.APIChannel, "type" | "id">) | (Partial<discord_api_types_v100.APIGuildForumChannel> & Pick<discord_api_types_v100.APIChannel, "type" | "id">) | (Partial<discord_api_types_v100.APIGuildMediaChannel> & Pick<discord_api_types_v100.APIChannel, "type" | "id">) | (Partial<discord_api_types_v100.APIGuildStageVoiceChannel> & Pick<discord_api_types_v100.APIChannel, "type" | "id">) | (Partial<discord_api_types_v100.APIGuildVoiceChannel> & Pick<discord_api_types_v100.APIChannel, "type" | "id">) | (Partial<discord_api_types_v100.APINewsChannel> & Pick<discord_api_types_v100.APIChannel, "type" | "id">) | (Partial<discord_api_types_v100.APIPrivateThreadChannel> & Pick<discord_api_types_v100.APIChannel, "type" | "id">) | (Partial<discord_api_types_v100.APIPublicThreadChannel> & Pick<discord_api_types_v100.APIChannel, "type" | "id">) | (Partial<discord_api_types_v100.APITextChannel> & Pick<discord_api_types_v100.APIChannel, "type" | "id">) | undefined;
|
|
363
363
|
get guildId(): string | undefined;
|
|
364
364
|
get guild(): APIPartialInteractionGuild | undefined;
|
|
365
365
|
get userId(): string | undefined;
|
|
366
366
|
get user(): APIUser;
|
|
367
|
-
get member():
|
|
367
|
+
get member(): discord_api_types_v100.APIInteractionGuildMember | undefined;
|
|
368
368
|
get locale(): Locale | undefined;
|
|
369
369
|
get guildLocale(): Locale | undefined;
|
|
370
370
|
get token(): string;
|
|
@@ -383,12 +383,12 @@ declare abstract class BaseInteraction<Type extends InteractionType$1, Context$1
|
|
|
383
383
|
guild: undefined;
|
|
384
384
|
guild_locale: undefined;
|
|
385
385
|
};
|
|
386
|
-
getAppEntitlements():
|
|
386
|
+
getAppEntitlements(): discord_api_types_v100.APIEntitlement[];
|
|
387
387
|
guildHavePremium(): boolean;
|
|
388
388
|
userHavePremium(): boolean;
|
|
389
389
|
private prepareResponsePayload;
|
|
390
|
-
reply(options: InteractionResponseCallbackData | string, forceEphemeral?: boolean): Promise<
|
|
391
|
-
deferReply(forceEphemeral?: boolean): Promise<
|
|
390
|
+
reply(options: InteractionResponseCallbackData | string, forceEphemeral?: boolean): Promise<discord_api_types_v100.RESTPostAPIInteractionCallbackWithResponseResult>;
|
|
391
|
+
deferReply(forceEphemeral?: boolean): Promise<discord_api_types_v100.RESTPostAPIInteractionCallbackWithResponseResult>;
|
|
392
392
|
/**
|
|
393
393
|
* Defers the update of a component interaction.
|
|
394
394
|
*
|
|
@@ -405,7 +405,7 @@ declare abstract class BaseInteraction<Type extends InteractionType$1, Context$1
|
|
|
405
405
|
* 4. Bot calls `editReply()` to update the original message.
|
|
406
406
|
*
|
|
407
407
|
*/
|
|
408
|
-
deferUpdate(): Promise<
|
|
408
|
+
deferUpdate(): Promise<discord_api_types_v100.RESTPostAPIInteractionCallbackWithResponseResult>;
|
|
409
409
|
/**
|
|
410
410
|
* Edits the original interaction response.
|
|
411
411
|
*
|
|
@@ -417,7 +417,7 @@ declare abstract class BaseInteraction<Type extends InteractionType$1, Context$1
|
|
|
417
417
|
*
|
|
418
418
|
* Before using this method, the interaction needs to be replied to first before using this method - with `reply`, `deferReply` or `update`.
|
|
419
419
|
*/
|
|
420
|
-
editReply(options: InteractionResponseCallbackData | string, messageId?: Snowflake$1 | "@original"): Promise<
|
|
420
|
+
editReply(options: InteractionResponseCallbackData | string, messageId?: Snowflake$1 | "@original"): Promise<discord_api_types_v100.APIMessage>;
|
|
421
421
|
/**
|
|
422
422
|
* Deletes the original interaction response (or a follow-up message).
|
|
423
423
|
*
|
|
@@ -438,7 +438,7 @@ declare abstract class BaseInteraction<Type extends InteractionType$1, Context$1
|
|
|
438
438
|
*
|
|
439
439
|
* After calling this method, the interaction is considered replied and you need to use `editReply` to edit the original response.
|
|
440
440
|
*/
|
|
441
|
-
update(options: InteractionResponseCallbackData | string): Promise<
|
|
441
|
+
update(options: InteractionResponseCallbackData | string): Promise<discord_api_types_v100.RESTPostAPIInteractionCallbackWithResponseResult>;
|
|
442
442
|
/**
|
|
443
443
|
* Sends a follow-up message to the interaction.
|
|
444
444
|
*
|
|
@@ -448,7 +448,7 @@ declare abstract class BaseInteraction<Type extends InteractionType$1, Context$1
|
|
|
448
448
|
*
|
|
449
449
|
* This is used to send additional messages after the initial interaction response.
|
|
450
450
|
*/
|
|
451
|
-
followUp(options: InteractionResponseCallbackData | string, forceEphemeral?: boolean): Promise<
|
|
451
|
+
followUp(options: InteractionResponseCallbackData | string, forceEphemeral?: boolean): Promise<discord_api_types_v100.APIMessage>;
|
|
452
452
|
isCommand(): this is CommandInteraction<ApplicationCommandType$1, Context$1>;
|
|
453
453
|
isChatInputCommand(): this is ChatInputCommandInteraction<Context$1>;
|
|
454
454
|
isUserContextCommand(): this is UserContextInteraction<Context$1>;
|
|
@@ -643,6 +643,14 @@ declare class SlashCommandHandler<Context$1 extends BaseInteractionContext = Bas
|
|
|
643
643
|
readonly handlerType = "slash";
|
|
644
644
|
private handlerFn?;
|
|
645
645
|
private autocompleteFn?;
|
|
646
|
+
/**
|
|
647
|
+
* Set of guild IDs where this command is registered (empty for global commands)
|
|
648
|
+
*/
|
|
649
|
+
readonly guildIds: Set<string>;
|
|
650
|
+
isGuildCommand(): boolean;
|
|
651
|
+
setGuildIds(guildIds: string[]): this;
|
|
652
|
+
addGuildIds(...guildIds: string[]): this;
|
|
653
|
+
removeGuildIds(...guildIds: string[]): this;
|
|
646
654
|
/**
|
|
647
655
|
* Adds the command handler function.
|
|
648
656
|
*
|
|
@@ -684,6 +692,14 @@ declare class SlashCommandHandler<Context$1 extends BaseInteractionContext = Bas
|
|
|
684
692
|
declare class ContextCommandHandler<T extends ContextCommandType = ContextCommandType, Context$1 extends BaseInteractionContext = BaseInteractionContext, InteractionData = (T extends ContextCommandType.User ? UserContextInteraction<Context$1> : MessageContextInteraction<Context$1>)> extends ContextMenuCommandBuilder {
|
|
685
693
|
readonly handlerType = "context";
|
|
686
694
|
private handlerFn?;
|
|
695
|
+
/**
|
|
696
|
+
* Set of guild IDs where this command is registered (empty for global commands)
|
|
697
|
+
*/
|
|
698
|
+
readonly guildIds: Set<string>;
|
|
699
|
+
isGuildCommand(): boolean;
|
|
700
|
+
setGuildIds(guildIds: string[]): this;
|
|
701
|
+
addGuildIds(...guildIds: string[]): this;
|
|
702
|
+
removeGuildIds(...guildIds: string[]): this;
|
|
687
703
|
addHandler(handler: (interaction: InteractionData) => Promise<any> | any): ContextCommandHandler<T, Context$1, InteractionData>;
|
|
688
704
|
/**
|
|
689
705
|
* Executes the command handler
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/resolvers/CommandOptionResolver.ts","../src/resolvers/ModalComponentResolver.ts","../src/interactions/ModalInteraction.ts","../src/interactions/ModalCapableInteraction.ts","../src/interactions/MessageComponentInteraction.ts","../src/interactions/CommandInteraction.ts","../src/interactions/ChatInputInteraction.ts","../src/interactions/UserContextCommandInteraction.ts","../src/interactions/MessageContextCommandInteraction.ts","../src/interactions/BaseInteraction.ts","../src/interactions/AutocompleteInteraction.ts","../src/types.ts","../src/interactions/handlers.ts","../src/Honocord.ts","../src/utils/Colors.ts","../src/utils/registerCommands.ts","../src/utils/index.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;KAeK,yBAAA;;;;;;;;QAQG;;;;;EARH;AAQ+B;;EAoCW,OAAA,EAAA,OAAgB;CADvD;;;;cArBF,gCAAA,CAgDW;EAYD;;;EAcqG,QAAA,MAAA;EAdhC;;;;;;;;EAcgC,QAAA,eAAA;;uBArD7G,2CACE,iBAAA,CAAgB,qBAAqB,iBAAA,CAAgB,yDAGjD;EAiDuG,IAAA,IAAA,CAAA,CAAA,EA1BpG,0CA0BoG,CA1BpG,iBAAA,CAAA,kBA0BoG,GA1BpG,iBAAA,CAAA,8BA0BoG,CAAA,EAAA;;;;;;;;;gBAdrG,kDAAkD,wBAAmB,Q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A,GAAA,CAAA;;;;UczRzC,MAAA;;;;;;;;;;;;;;EdcL,UAAA,EAAA,MAAA;EAsBC;EAsBI,QAAA,EAAA,MAAgB;EAAqB;EADvC,SAAA,EAAA,MAAA;EAIM;EAuBG,QAAA,EAAA,MAAA;EAAA;EAAA,QAAA,EAAA,MAAA;EAYD;EAAkD,UAAA,EAAA,MAAA;EAAC;EAckD,UAAA,EAAA,MAAA;EAdhC;EAAA,OAAA,EAAA,MAAA;EAcgC;;;EAAA,OAAA,EAAA,MAAA;;;EAAA;;;EAAA,KAAA,EAAA,MAAA;;;EAAA;;;EAAA,SAAA,EAAA,MAAA;;;;EAAA,IAAA,EAAA,MAAA;;;;EAAA,MAAA,EAAA,MAAA;;;;EAAA,GAAA,EAAA,MAAA;;;;EAAA,MAAA,EAAA,MAAA;;AAmCrG,cclFH,MdkFG,EclFK,MdkFL;;;iBe7IM,gBAAA,4EAGP,kBAAkB,WAAQ;;;iBCLzB,aAAA;iBACA,aAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/resolvers/CommandOptionResolver.ts","../src/resolvers/ModalComponentResolver.ts","../src/interactions/ModalInteraction.ts","../src/interactions/ModalCapableInteraction.ts","../src/interactions/MessageComponentInteraction.ts","../src/interactions/CommandInteraction.ts","../src/interactions/ChatInputInteraction.ts","../src/interactions/UserContextCommandInteraction.ts","../src/interactions/MessageContextCommandInteraction.ts","../src/interactions/BaseInteraction.ts","../src/interactions/AutocompleteInteraction.ts","../src/types.ts","../src/interactions/handlers.ts","../src/Honocord.ts","../src/utils/Colors.ts","../src/utils/registerCommands.ts","../src/utils/index.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;KAeK,yBAAA;;;;;;;;QAQG;;;;;EARH;AAQ+B;;EAoCW,OAAA,EAAA,OAAgB;CADvD;;;;cArBF,gCAAA,CAgDW;EAYD;;;EAcqG,QAAA,MAAA;EAdhC;;;;;;;;EAcgC,QAAA,eAAA;;uBArD7G,2CACE,iB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,MAAA;;;EAAA;;;EAAA,KAAA,EAAA,MAAA;;;EAAA;;;EAAA,SAAA,EAAA,MAAA;;;;EAAA,IAAA,EAAA,MAAA;;;;EAAA,MAAA,EAAA,MAAA;;;;EAAA,GAAA,EAAA,MAAA;;;;EAAA,MAAA,EAAA,MAAA;;AAmCrG,cclFH,MdkFG,EclFK,MdkFL;;;iBe5IM,gBAAA,4EAGP,kBAAkB,WAAQ;;;iBCNzB,aAAA;iBACA,aAAA"}
|
package/dist/index.mjs
CHANGED
|
@@ -534,21 +534,43 @@ const Colors = {
|
|
|
534
534
|
//#endregion
|
|
535
535
|
//#region src/utils/registerCommands.ts
|
|
536
536
|
async function registerCommands(token, applicationId, ...handlers) {
|
|
537
|
-
const
|
|
538
|
-
if (handler.handlerType === "slash" || handler.handlerType === "context") return handler
|
|
539
|
-
}).filter((cmd) => cmd !== void 0)
|
|
537
|
+
const { globalCommands, guildCommands } = handlers.flat(Infinity).map((handler) => {
|
|
538
|
+
if (handler.handlerType === "slash" || handler.handlerType === "context") return handler;
|
|
539
|
+
}).filter((cmd) => cmd !== void 0).reduce((acc, cmd) => {
|
|
540
|
+
if (cmd.isGuildCommand()) for (const guildId of cmd.guildIds.values()) {
|
|
541
|
+
if (!acc.guildCommands[guildId]) acc.guildCommands[guildId] = [];
|
|
542
|
+
acc.guildCommands[guildId].push(cmd.toJSON());
|
|
543
|
+
}
|
|
544
|
+
else acc.globalCommands.push(cmd.toJSON());
|
|
545
|
+
return acc;
|
|
546
|
+
}, {
|
|
547
|
+
globalCommands: [],
|
|
548
|
+
guildCommands: {}
|
|
549
|
+
});
|
|
540
550
|
if (!token || !applicationId) {
|
|
541
551
|
console.warn("Token or Application ID not provided, skipping command registration.");
|
|
542
552
|
return;
|
|
543
553
|
}
|
|
544
554
|
const api = new API(new REST({ version: "10" }).setToken(token));
|
|
545
555
|
try {
|
|
546
|
-
await api.applicationCommands.bulkOverwriteGlobalCommands(applicationId,
|
|
547
|
-
console.log(
|
|
556
|
+
await api.applicationCommands.bulkOverwriteGlobalCommands(applicationId, globalCommands);
|
|
557
|
+
console.log(`---- ✅ Successfully registered ${globalCommands.length} global commands ----`);
|
|
548
558
|
} catch (error) {
|
|
549
559
|
console.error("---- ❌ Error registering global commands ----");
|
|
550
560
|
throw error;
|
|
551
561
|
}
|
|
562
|
+
if (Object.keys(guildCommands).length === 0) return;
|
|
563
|
+
const guildCommandsArray = Object.entries(guildCommands).map(([guildId, commands]) => ({
|
|
564
|
+
guildId,
|
|
565
|
+
commands
|
|
566
|
+
}));
|
|
567
|
+
for (const { guildId, commands } of guildCommandsArray) try {
|
|
568
|
+
await api.applicationCommands.bulkOverwriteGuildCommands(applicationId, guildId, commands);
|
|
569
|
+
console.log(`---- ✅ Successfully registered ${commands.length} guild commands for guild ${guildId} ----`);
|
|
570
|
+
} catch (error) {
|
|
571
|
+
console.error(`---- ❌ Error registering guild commands for guild ${guildId} ----`);
|
|
572
|
+
throw error;
|
|
573
|
+
}
|
|
552
574
|
}
|
|
553
575
|
|
|
554
576
|
//#endregion
|
|
@@ -761,6 +783,26 @@ var SlashCommandHandler = class extends SlashCommandBuilder {
|
|
|
761
783
|
handlerFn;
|
|
762
784
|
autocompleteFn;
|
|
763
785
|
/**
|
|
786
|
+
* Set of guild IDs where this command is registered (empty for global commands)
|
|
787
|
+
*/
|
|
788
|
+
guildIds = /* @__PURE__ */ new Set();
|
|
789
|
+
isGuildCommand() {
|
|
790
|
+
return this.guildIds.size > 0;
|
|
791
|
+
}
|
|
792
|
+
setGuildIds(guildIds) {
|
|
793
|
+
this.guildIds.clear();
|
|
794
|
+
for (const guildId of guildIds) this.guildIds.add(guildId);
|
|
795
|
+
return this;
|
|
796
|
+
}
|
|
797
|
+
addGuildIds(...guildIds) {
|
|
798
|
+
for (const guildId of guildIds) this.guildIds.add(guildId);
|
|
799
|
+
return this;
|
|
800
|
+
}
|
|
801
|
+
removeGuildIds(...guildIds) {
|
|
802
|
+
for (const guildId of guildIds) this.guildIds.delete(guildId);
|
|
803
|
+
return this;
|
|
804
|
+
}
|
|
805
|
+
/**
|
|
764
806
|
* Adds the command handler function.
|
|
765
807
|
*
|
|
766
808
|
* @param handler The function to handle the command interaction
|
|
@@ -846,6 +888,26 @@ var SlashCommandHandler = class extends SlashCommandBuilder {
|
|
|
846
888
|
var ContextCommandHandler = class extends ContextMenuCommandBuilder {
|
|
847
889
|
handlerType = "context";
|
|
848
890
|
handlerFn;
|
|
891
|
+
/**
|
|
892
|
+
* Set of guild IDs where this command is registered (empty for global commands)
|
|
893
|
+
*/
|
|
894
|
+
guildIds = /* @__PURE__ */ new Set();
|
|
895
|
+
isGuildCommand() {
|
|
896
|
+
return this.guildIds.size > 0;
|
|
897
|
+
}
|
|
898
|
+
setGuildIds(guildIds) {
|
|
899
|
+
this.guildIds.clear();
|
|
900
|
+
for (const guildId of guildIds) this.guildIds.add(guildId);
|
|
901
|
+
return this;
|
|
902
|
+
}
|
|
903
|
+
addGuildIds(...guildIds) {
|
|
904
|
+
for (const guildId of guildIds) this.guildIds.add(guildId);
|
|
905
|
+
return this;
|
|
906
|
+
}
|
|
907
|
+
removeGuildIds(...guildIds) {
|
|
908
|
+
for (const guildId of guildIds) this.guildIds.delete(guildId);
|
|
909
|
+
return this;
|
|
910
|
+
}
|
|
849
911
|
addHandler(handler) {
|
|
850
912
|
this.handlerFn = handler;
|
|
851
913
|
return this;
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["Collection","InteractionType","ApplicationCommandType","ComponentType","ModalBuilder","Collection","ComponentType","ApplicationCommandType","InteractionType"],"sources":["../src/resolvers/CommandOptionResolver.ts","../src/interactions/BaseInteraction.ts","../src/interactions/ModalCapableInteraction.ts","../src/interactions/CommandInteraction.ts","../src/interactions/ChatInputInteraction.ts","../src/utils/discordVerify.ts","../src/utils/Colors.ts","../src/utils/registerCommands.ts","../src/utils/index.ts","../src/interactions/UserContextCommandInteraction.ts","../src/interactions/MessageContextCommandInteraction.ts","../src/interactions/MessageComponentInteraction.ts","../src/resolvers/ModalComponentResolver.ts","../src/interactions/ModalInteraction.ts","../src/interactions/AutocompleteInteraction.ts","../src/interactions/handlers.ts","../src/Honocord.ts"],"sourcesContent":["import { Collection } from \"@discordjs/collection\";\nimport {\n APIApplicationCommandInteractionDataOption,\n APIAttachment,\n APIInteractionDataResolved,\n APIInteractionDataResolvedChannel,\n APIInteractionDataResolvedGuildMember,\n APIRole,\n APIUser,\n ApplicationCommandOptionType,\n ChannelType,\n InteractionType,\n} from \"discord-api-types/v10\";\nimport { APIInteractionDataResolvedCollections } from \"../types\";\n\ntype AutocompleteFocusedOption = {\n /**\n * The name of the option.\n */\n name: string;\n /**\n * The type of the application command option.\n */\n type: ApplicationCommandOptionType;\n /**\n * The value of the option.\n */\n value: string;\n /**\n * Whether the option is focused.\n */\n focused: boolean;\n};\n\n/**\n * A resolver for command interaction options.\n */\nclass CommandInteractionOptionResolver {\n /**\n * The name of the subcommand group.\n */\n private _group: string | null = null;\n /**\n * The name of the subcommand.\n */\n private _subcommand: string | null = null;\n /**\n * The bottom-level options for the interaction.\n * If there is a subcommand (or subcommand and group), this is the options for the subcommand.\n */\n private _hoistedOptions: APIApplicationCommandInteractionDataOption<\n InteractionType.ApplicationCommand | InteractionType.ApplicationCommandAutocomplete\n >[];\n\n private _resolved: APIInteractionDataResolvedCollections;\n\n constructor(\n options:\n | APIApplicationCommandInteractionDataOption<\n InteractionType.ApplicationCommand | InteractionType.ApplicationCommandAutocomplete\n >[]\n | undefined,\n resolved: APIInteractionDataResolved | undefined\n ) {\n this._hoistedOptions = options ?? [];\n this._resolved = Object.keys(resolved ?? {}).reduce((acc, key) => {\n const resolvedData = resolved?.[key as keyof APIInteractionDataResolved];\n const collection = new Collection(resolvedData ? Object.entries(resolvedData) : []);\n acc[key as keyof APIInteractionDataResolvedCollections] = collection;\n return acc;\n }, {} as Partial<APIInteractionDataResolvedCollections>);\n\n // Hoist subcommand group if present\n if (this._hoistedOptions[0]?.type === ApplicationCommandOptionType.SubcommandGroup) {\n this._group = this._hoistedOptions[0].name;\n this._hoistedOptions = this._hoistedOptions[0].options ?? [];\n }\n\n // Hoist subcommand if present\n if (this._hoistedOptions[0]?.type === ApplicationCommandOptionType.Subcommand) {\n this._subcommand = this._hoistedOptions[0].name;\n this._hoistedOptions = this._hoistedOptions[0].options ?? [];\n }\n }\n\n public get data() {\n return this._hoistedOptions;\n }\n\n /**\n * Gets an option by its name.\n *\n * @param name The name of the option.\n * @param type The expected type of the option.\n * @param required Whether to throw an error if the option is not found.\n * @returns The option, if found.\n */\n get<T extends ApplicationCommandOptionType>(name: string, type: T, required = false) {\n const option = this._hoistedOptions.find((opt) => opt.name === name);\n if (!option) {\n if (required) {\n throw new TypeError(\"Option not found\", { cause: { name } });\n }\n\n return null;\n }\n\n if (option.type !== type) {\n throw new TypeError(\"Option type mismatch\", { cause: { name, type: option.type, expected: type } });\n }\n\n return option as Extract<APIApplicationCommandInteractionDataOption<InteractionType.ApplicationCommand>, { type: T }>;\n }\n\n /**\n * Gets the selected subcommand.\n *\n * @param {boolean} [required=true] Whether to throw an error if there is no subcommand.\n * @returns {?string} The name of the selected subcommand, or null if not set and not required.\n */\n getSubcommand(): string | null;\n getSubcommand(required: true): string;\n getSubcommand(required: boolean = true): string | null {\n if (required && !this._subcommand) {\n throw new TypeError(\"No subcommand selected\");\n }\n\n return this._subcommand;\n }\n\n /**\n * Gets the selected subcommand group.\n *\n * @param required Whether to throw an error if there is no subcommand group.\n * @returns The name of the selected subcommand group, or null if not set and not required.\n */\n getSubcommandGroup(required?: boolean): string | null;\n getSubcommandGroup(required: true): string;\n getSubcommandGroup(required: boolean = false): string | null {\n if (required && !this._group) {\n throw new TypeError(\"No subcommand group selected\");\n }\n\n return this._group;\n }\n\n getFocused(): AutocompleteFocusedOption | null {\n return (this._hoistedOptions as AutocompleteFocusedOption[]).find((option) => option.focused) || null;\n }\n\n /**\n * Gets a boolean option.\n *\n * @param name The name of the option.\n * @param required Whether to throw an error if the option is not found.\n * @returns The value of the option, or null if not set and not required.\n */\n getBoolean(name: string, required?: boolean): boolean | null;\n getBoolean(name: string, required: true): boolean;\n getBoolean(name: string, required: boolean = false): boolean | null {\n const option = this.get(name, ApplicationCommandOptionType.Boolean, required);\n return option ? option.value : null;\n }\n\n /**\n * Gets a channel option.\n *\n * @param name The name of the option.\n * @param required Whether to throw an error if the option is not found.\n * @param channelTypes The allowed types of channels. If empty, all channel types are allowed.\n * @returns The value of the option, or null if not set and not required.\n */\n getChannel(name: string, required: false, channelTypes: ChannelType[]): APIInteractionDataResolvedChannel | null;\n getChannel(name: string, required: true, channelTypes: ChannelType[]): APIInteractionDataResolvedChannel;\n getChannel(\n name: string,\n required: boolean = false,\n channelTypes: ChannelType[] = []\n ): APIInteractionDataResolvedChannel | null {\n const option = this.get(name, ApplicationCommandOptionType.Channel, required);\n const channel = option ? this._resolved.channels?.get(option.value) || null : null;\n\n if (channel && channelTypes.length > 0 && !channelTypes.includes(channel.type)) {\n throw new TypeError(\"Invalid channel type\", { cause: { name, type: channel.type, expected: channelTypes.join(\", \") } });\n }\n\n return channel;\n }\n\n /**\n * Gets a string option.\n *\n * @param name The name of the option.\n * @param required Whether to throw an error if the option is not found.\n * @returns The value of the option, or null if not set and not required.\n */\n getString<T extends string = string>(name: string, required?: boolean): T | null;\n getString<T extends string = string>(name: string, required: true): T;\n getString<T extends string = string>(name: string, required: boolean = false): T | null {\n const option = this.get(name, ApplicationCommandOptionType.String, required);\n return (option?.value as T) ?? null;\n }\n\n /**\n * Gets an integer option.\n *\n * @param name The name of the option.\n * @param required Whether to throw an error if the option is not found.\n * @returns The value of the option, or null if not set and not required.\n */\n getInteger(name: string, required?: boolean): number | null;\n getInteger(name: string, required: true): number;\n getInteger(name: string, required: boolean = false): number | null {\n const option = this.get(name, ApplicationCommandOptionType.Integer, required);\n return option?.value ?? null;\n }\n\n /**\n * Gets a number option.\n *\n * @param name The name of the option.\n * @param required Whether to throw an error if the option is not found.\n * @returns The value of the option, or null if not set and not required.\n */\n getNumber(name: string, required?: boolean): number | null;\n getNumber(name: string, required: true): number;\n getNumber(name: string, required: boolean = false): number | null {\n const option = this.get(name, ApplicationCommandOptionType.Number, required);\n return option?.value ?? null;\n }\n\n /**\n * Gets a user option.\n *\n * @param name The name of the option.\n * @param required Whether to throw an error if the option is not found.\n * @returns The value of the option, or null if not set and not required.\n */\n getUser(name: string, required?: boolean): APIUser | null;\n getUser(name: string, required: true): APIUser;\n getUser(name: string, required: boolean = false): APIUser | null {\n const option = this.get(name, ApplicationCommandOptionType.User, required);\n const user = option ? this._resolved.users?.get(option.value) || null : null;\n return user;\n }\n\n /**\n * Gets a member option.\n *\n * @param name The name of the option.\n * @returns The value of the option, or null if the user is not present in the guild or the option is not set.\n */\n getMember(name: string, required?: boolean): APIInteractionDataResolvedGuildMember | null;\n getMember(name: string, required: true): APIInteractionDataResolvedGuildMember;\n getMember(name: string, required: boolean = false): APIInteractionDataResolvedGuildMember | null {\n const option = this.get(name, ApplicationCommandOptionType.User, required);\n const member = option ? this._resolved.members?.get(option.value) || null : null;\n return member;\n }\n\n /**\n * Gets a role option.\n *\n * @param name The name of the option.\n * @param required Whether to throw an error if the option is not found.\n * @returns The value of the option, or null if not set and not required.\n */\n getRole(name: string, required?: boolean): APIRole | null;\n getRole(name: string, required: true): APIRole;\n getRole(name: string, required: boolean = false): APIRole | null {\n const option = this.get(name, ApplicationCommandOptionType.Role, required);\n const role = option ? this._resolved.roles?.get(option.value) || null : null;\n return role;\n }\n\n /**\n * Gets an attachment option.\n *\n * @param name The name of the option.\n * @param required Whether to throw an error if the option is not found.\n * @returns The value of the option, or null if not set and not required.\n */\n getAttachment(name: string, required?: boolean): APIAttachment | null;\n getAttachment(name: string, required: true): APIAttachment;\n getAttachment(name: string, required: boolean = false): APIAttachment | null {\n const option = this.get(name, ApplicationCommandOptionType.Attachment, required);\n const attachment = option ? this._resolved.attachments?.get(option.value) || null : null;\n return attachment;\n }\n\n /**\n * Gets a mentionable option.\n *\n * @param name The name of the option.\n * @param required Whether to throw an error if the option is not found.\n * @returns The value of the option, or null if not set and not required.\n */\n getMentionable(name: string, required?: boolean): APIInteractionDataResolvedGuildMember | APIUser | APIRole | null;\n getMentionable(name: string, required: true): APIInteractionDataResolvedGuildMember | APIUser | APIRole;\n getMentionable(name: string, required: boolean = false): (APIInteractionDataResolvedGuildMember | APIUser | APIRole) | null {\n const option = this.get(name, ApplicationCommandOptionType.Mentionable, required);\n const user = option ? this._resolved.users?.get(option.value) || null : null;\n const member = option ? this._resolved.members?.get(option.value) || null : null;\n const role = option ? this._resolved.roles?.get(option.value) || null : null;\n return member ?? user ?? role ?? null;\n }\n}\n\nexport { CommandInteractionOptionResolver };\n","import {\n type Snowflake,\n APIInteractionResponseCallbackData,\n APIPartialInteractionGuild,\n APIUser,\n ApplicationCommandType,\n InteractionType,\n Locale,\n APIApplicationCommandInteraction,\n ComponentType,\n APIMessageComponentInteraction,\n} from \"discord-api-types/v10\";\nimport { API } from \"@discordjs/core/http-only\";\nimport { REST } from \"@discordjs/rest\";\nimport { ModalInteraction } from \"./ModalInteraction\";\nimport type {\n BaseInteractionContext,\n InteractionResponseCallbackData,\n JSONEncodable,\n MessageComponentType,\n ValidInteraction,\n} from \"../types\";\nimport { MessageComponentInteraction } from \"./MessageComponentInteraction\";\nimport { AutocompleteInteraction } from \"./AutocompleteInteraction\";\nimport { CommandInteraction } from \"./CommandInteraction\";\nimport { ChatInputCommandInteraction } from \"./ChatInputInteraction\";\nimport { UserContextInteraction } from \"./UserContextCommandInteraction\";\nimport { MessageContextInteraction } from \"./MessageContextCommandInteraction\";\n\nfunction snakeCase(str: string): string {\n return str\n .replace(/([a-z0-9])([A-Z])/g, \"$1_$2\")\n .replace(/([A-Z])([A-Z][a-z])/g, \"$1_$2\")\n .toLowerCase();\n}\n\n/**\n * Transforms camel-cased keys into snake cased keys\n *\n * @param {*} obj The object to transform\n * @returns {*} The transformed object\n */\nfunction toSnakeCase(obj: any): any {\n if (typeof obj !== \"object\" || !obj) return obj;\n if (obj instanceof Date) return obj;\n if (isJSONEncodable(obj)) return toSnakeCase(obj.toJSON());\n if (Array.isArray(obj)) return obj.map(toSnakeCase);\n return Object.fromEntries(Object.entries(obj).map(([key, value]) => [snakeCase(key), toSnakeCase(value)]));\n}\n\n/**\n * Indicates if an object is encodable or not.\n *\n * @param maybeEncodable - The object to check against\n */\nfunction isJSONEncodable(maybeEncodable: unknown): maybeEncodable is JSONEncodable<unknown> {\n return (\n maybeEncodable !== null &&\n typeof maybeEncodable === \"object\" &&\n \"toJSON\" in maybeEncodable &&\n typeof maybeEncodable[\"toJSON\"] === \"function\"\n );\n}\n\nabstract class BaseInteraction<Type extends InteractionType, Context extends BaseInteractionContext = BaseInteractionContext> {\n public readonly type: Type;\n /** The raw interaction data */\n protected readonly raw: Extract<ValidInteraction, { type: Type }>;\n public readonly rest: REST;\n protected _ephemeral: boolean | null = null;\n protected replied: boolean = false;\n protected deferred: boolean = false;\n public readonly context: Context;\n\n constructor(\n protected api: API,\n data: Extract<ValidInteraction, { type: Type }>,\n context: Context\n ) {\n this.type = data.type as Type;\n this.raw = { ...data };\n this.rest = api.rest;\n this.context = context;\n }\n\n get applicationId() {\n return this.raw.application_id;\n }\n\n get entitlements() {\n return this.raw.entitlements;\n }\n\n get channelId() {\n return this.raw.channel?.id;\n }\n\n get channel() {\n return this.raw.channel;\n }\n\n get guildId() {\n return this.raw.guild_id;\n }\n\n get guild() {\n return this.raw.guild;\n }\n\n get userId() {\n return this.raw.user?.id;\n }\n\n get user() {\n return (this.raw.member?.user || this.raw.user) as APIUser; // One is always given.\n }\n\n get member() {\n return this.raw.member;\n }\n\n get locale() {\n return this.raw.guild_locale;\n }\n\n get guildLocale() {\n return this.raw.guild_locale;\n }\n\n get token() {\n return this.raw.token;\n }\n\n get id() {\n return this.raw.id;\n }\n\n get appPermissions() {\n return this.raw.app_permissions;\n }\n\n get version() {\n return this.raw.version;\n }\n\n protected isJSONEncodable(obj: unknown): obj is JSONEncodable<unknown> {\n return isJSONEncodable(obj);\n }\n\n protected toSnakeCase(obj: unknown): unknown {\n return toSnakeCase(obj);\n }\n\n inGuild(): this is BaseInteraction<Type> & { guild_id: Snowflake; guild: APIPartialInteractionGuild; guild_locale: Locale } {\n return Boolean(this.raw.guild_id && this.raw.guild && this.raw.guild_locale);\n }\n\n inDM(): this is BaseInteraction<Type> & { guild_id: undefined; guild: undefined; guild_locale: undefined } {\n return !this.inGuild();\n }\n\n getAppEntitlements() {\n return this.entitlements.filter((entitlement) => entitlement.application_id === this.applicationId);\n }\n\n guildHavePremium(): boolean {\n return (\n this.getAppEntitlements().filter(\n (entitlement) =>\n entitlement.guild_id === this.guildId && (!entitlement.ends_at || new Date(entitlement.ends_at) > new Date())\n ).length > 0\n );\n }\n\n userHavePremium(): boolean {\n return (\n this.getAppEntitlements().filter(\n (entitlement) =>\n entitlement.user_id === this.userId && (!entitlement.ends_at || new Date(entitlement.ends_at) > new Date())\n ).length > 0\n );\n }\n\n private prepareResponsePayload(options: InteractionResponseCallbackData): APIInteractionResponseCallbackData {\n return this.toSnakeCase({\n ...options,\n components: options.components?.map((component) => (this.isJSONEncodable(component) ? component.toJSON() : component)),\n embeds: options.embeds?.map((embed) => (this.isJSONEncodable(embed) ? embed.toJSON() : embed)),\n }) as APIInteractionResponseCallbackData;\n }\n\n async reply(options: InteractionResponseCallbackData | string, forceEphemeral = true) {\n const replyOptions = typeof options === \"string\" ? { content: options } : options;\n if (forceEphemeral) {\n replyOptions.flags = (replyOptions.flags ?? 0) | 64;\n }\n const response = await this.api.interactions.reply(\n this.id,\n this.token,\n { ...this.prepareResponsePayload(replyOptions), with_response: true },\n {\n signal: AbortSignal.timeout(5000),\n }\n );\n this.replied = true;\n return response;\n }\n\n async deferReply(forceEphemeral = true) {\n const response = await this.api.interactions.defer(this.id, this.token, {\n flags: forceEphemeral ? 64 : undefined,\n with_response: true,\n });\n this.deferred = true;\n return response;\n }\n\n /**\n * Defers the update of a component interaction.\n *\n * @returns A promise that resolves when the update is deferred\n *\n * Responding to a component interaction via the deferUpdate() method acknowledges the interaction and resets the message state.\n * This method can be used to suppress the need for further responses, however it's encouraged to provide meaningful feedback to users via an update() or ephemeral reply() at least.\\\n * Once deferUpdate() has been called, future messages can be sent by calling followUp() or edits can be made by calling editReply() on the component interaction.\n *\n * Example flow:\n * 1. User clicks a button.\n * 2. Bot calls `deferUpdate()` to acknowledge the interaction.\n * 3. Bot performs some processing.\n * 4. Bot calls `editReply()` to update the original message.\n *\n */\n deferUpdate() {\n return this.api.interactions.deferMessageUpdate(this.id, this.token, { with_response: true });\n }\n\n /**\n * Edits the original interaction response.\n *\n * @param options - The options to edit the message with\n * @param messageId - The message id to edit, defaults to `@original`\n * @returns The edited message\n *\n * This is used to edit the original interaction response message.\n *\n * Before using this method, the interaction needs to be replied to first before using this method - with `reply`, `deferReply` or `update`.\n */\n async editReply(options: InteractionResponseCallbackData | string, messageId: Snowflake | \"@original\" = \"@original\") {\n const replyOptions = typeof options === \"string\" ? { content: options } : options;\n const response = await this.api.interactions.editReply(\n this.applicationId,\n this.token,\n this.prepareResponsePayload(replyOptions),\n messageId,\n {\n signal: AbortSignal.timeout(5000),\n }\n );\n this.replied = true;\n return response;\n }\n\n /**\n * Deletes the original interaction response (or a follow-up message).\n *\n * @param messageId - The message id to delete, defaults to `@original`\n * @returns A promise that resolves when the message is deleted\n *\n * This is used to delete the original interaction response message or a follow-up message.\n */\n deleteReply(messageId?: Snowflake | \"@original\") {\n return this.api.interactions.deleteReply(this.applicationId, this.token, messageId);\n }\n\n /**\n * Updates the original interaction response.\n *\n * @param options - The options to update the message with\n * @returns The updated message\n *\n * This is mainly used for component interactions where you want to update the message the component is attached to OR for\n * moodal submit interactions to update the message that opened the modal.\n *\n * After calling this method, the interaction is considered replied and you need to use `editReply` to edit the original response.\n */\n async update(options: InteractionResponseCallbackData | string) {\n const updateOptions = typeof options === \"string\" ? { content: options } : options;\n const response = await this.api.interactions.updateMessage(\n this.id,\n this.token,\n { ...this.prepareResponsePayload(updateOptions), with_response: true },\n {\n signal: AbortSignal.timeout(5000),\n }\n );\n this.replied = true;\n return response;\n }\n\n /**\n * Sends a follow-up message to the interaction.\n *\n * @param options - The options to send the follow-up message with\n * @param forceEphemeral - Whether to force the message to be ephemeral\n * @returns The sent follow-up message\n *\n * This is used to send additional messages after the initial interaction response.\n */\n async followUp(options: InteractionResponseCallbackData | string, forceEphemeral = false) {\n const followUpOptions = typeof options === \"string\" ? { content: options } : options;\n if (forceEphemeral) {\n followUpOptions.flags = (followUpOptions.flags ?? 0) | 64;\n }\n const response = await this.api.interactions.followUp(\n this.applicationId,\n this.token,\n this.prepareResponsePayload(followUpOptions),\n {\n signal: AbortSignal.timeout(5000),\n }\n );\n return response;\n }\n\n // Typeguards\n isCommand(): this is CommandInteraction<ApplicationCommandType, Context> {\n return this.raw.type === InteractionType.ApplicationCommand;\n }\n\n isChatInputCommand(): this is ChatInputCommandInteraction<Context> {\n return (\n this.raw.type === InteractionType.ApplicationCommand &&\n (this.raw as APIApplicationCommandInteraction).data.type === ApplicationCommandType.ChatInput\n );\n }\n\n isUserContextCommand(): this is UserContextInteraction<Context> {\n return (\n this.raw.type === InteractionType.ApplicationCommand &&\n (this.raw as APIApplicationCommandInteraction).data.type === ApplicationCommandType.User\n );\n }\n\n isMessageContextCommand(): this is MessageContextInteraction<Context> {\n return (\n this.raw.type === InteractionType.ApplicationCommand &&\n (this.raw as APIApplicationCommandInteraction).data.type === ApplicationCommandType.Message\n );\n }\n\n isModal(): this is ModalInteraction {\n return this.raw.type === InteractionType.ModalSubmit;\n }\n\n isMessageComponent(): this is MessageComponentInteraction<MessageComponentType, Context> {\n return this.raw.type === InteractionType.MessageComponent;\n }\n\n isButton(): this is MessageComponentInteraction<ComponentType.Button, Context> {\n return this.isMessageComponent() && this.raw.data.component_type === ComponentType.Button;\n }\n\n isStringSelect(): this is MessageComponentInteraction<ComponentType.StringSelect, Context> {\n return this.isMessageComponent() && this.raw.data.component_type === ComponentType.StringSelect;\n }\n\n isUserSelect(): this is MessageComponentInteraction<ComponentType.UserSelect, Context> {\n return this.isMessageComponent() && this.raw.data.component_type === ComponentType.UserSelect;\n }\n\n isRoleSelect(): this is MessageComponentInteraction<ComponentType.RoleSelect, Context> {\n return this.isMessageComponent() && this.raw.data.component_type === ComponentType.RoleSelect;\n }\n\n isMentionableSelect(): this is MessageComponentInteraction<ComponentType.MentionableSelect, Context> {\n return this.isMessageComponent() && this.raw.data.component_type === ComponentType.MentionableSelect;\n }\n\n isChannelSelect(): this is MessageComponentInteraction<ComponentType.ChannelSelect, Context> {\n return this.isMessageComponent() && this.raw.data.component_type === ComponentType.ChannelSelect;\n }\n\n isAutocomplete(): this is AutocompleteInteraction<Context> & { type: InteractionType.ApplicationCommandAutocomplete } {\n return this.raw.type === InteractionType.ApplicationCommandAutocomplete;\n }\n}\n\nexport { BaseInteraction };\n","import { InteractionType } from \"discord-api-types/v10\";\nimport { ModalBuilder } from \"@discordjs/builders\";\nimport { BaseInteraction } from \"./BaseInteraction\";\nimport type { BaseInteractionContext, ModalInteractionResponseCallbackData } from \"../types\";\n\nclass ModalCapableInteraction<\n Type extends InteractionType,\n Context extends BaseInteractionContext = BaseInteractionContext,\n> extends BaseInteraction<Type, Context> {\n /**\n * Responds to the interaction with a modal.\n *\n * @param data - The modal data to send\n */\n showModal(data: ModalInteractionResponseCallbackData | ModalBuilder) {\n const responseData = {\n ...(data instanceof ModalBuilder ? data.toJSON() : data),\n components:\n data instanceof ModalBuilder\n ? data.components.map((row) => row.toJSON())\n : data.components.map((row) => (this.isJSONEncodable(row) ? row.toJSON() : row)),\n };\n return this.api.interactions.createModal(this.id, this.token, responseData);\n }\n}\n\nexport { ModalCapableInteraction };\n","import { APIApplicationCommandInteraction, ApplicationCommandType, InteractionType } from \"discord-api-types/v10\";\nimport { API } from \"@discordjs/core/http-only\";\nimport { BaseInteractionContext } from \"../types\";\nimport { ModalCapableInteraction } from \"./ModalCapableInteraction\";\n\nabstract class CommandInteraction<\n CType extends ApplicationCommandType = ApplicationCommandType,\n Context extends BaseInteractionContext = BaseInteractionContext,\n> extends ModalCapableInteraction<InteractionType.ApplicationCommand, Context> {\n public readonly commandType: CType;\n\n constructor(api: API, interaction: Extract<APIApplicationCommandInteraction, { data: { type: CType } }>, c: Context) {\n super(api, interaction, c);\n this.commandType = interaction.data.type;\n }\n\n get commandName() {\n return this.raw.data.name;\n }\n\n get commandId() {\n return this.raw.data.id;\n }\n\n isOfType<T extends ApplicationCommandType>(type: T): this is CommandInteraction<T, Context> {\n return (this.commandType as ApplicationCommandType) === type;\n }\n}\n\nexport { CommandInteraction };\n","import { ApplicationCommandType, type APIChatInputApplicationCommandInteraction } from \"discord-api-types/v10\";\nimport { CommandInteractionOptionResolver } from \"@resolvers/CommandOptionResolver\";\nimport { API } from \"@discordjs/core/http-only\";\nimport { BaseInteractionContext } from \"../types\";\nimport { CommandInteraction } from \"./CommandInteraction\";\n\nclass ChatInputCommandInteraction<Context extends BaseInteractionContext = BaseInteractionContext> extends CommandInteraction<\n ApplicationCommandType.ChatInput,\n Context\n> {\n public readonly options: CommandInteractionOptionResolver;\n\n constructor(api: API, interaction: APIChatInputApplicationCommandInteraction, c: Context) {\n super(api, interaction, c);\n this.options = new CommandInteractionOptionResolver(interaction.data.options, interaction.data.resolved);\n }\n}\n\nexport { ChatInputCommandInteraction };\n","import type { APIInteraction, APIWebhookEvent } from \"discord-api-types/v10\";\nimport { cloneRawRequest, type HonoRequest } from \"hono/request\";\nimport { BufferSource } from \"../types\";\n\nexport const subtleCrypto = crypto.subtle;\n\n/**\n * Converts different types to Uint8Array.\n *\n * @param value - Value to convert. Strings are parsed as hex.\n * @param format - Format of value. Valid options: 'hex'. Defaults to utf-8.\n * @returns Value in Uint8Array form.\n */\nexport function valueToUint8Array(value: Uint8Array | ArrayBuffer | Buffer | string, format?: string): Uint8Array {\n if (value == null) {\n return new Uint8Array();\n }\n if (typeof value === \"string\") {\n if (format === \"hex\") {\n const matches = value.match(/.{1,2}/g);\n if (matches == null) {\n throw new Error(\"Value is not a valid hex string\");\n }\n const hexVal = matches.map((byte: string) => Number.parseInt(byte, 16));\n return new Uint8Array(hexVal);\n }\n\n return new TextEncoder().encode(value);\n }\n try {\n if (Buffer.isBuffer(value)) {\n return new Uint8Array(value);\n }\n } catch (_ex) {\n // Runtime doesn't have Buffer\n }\n if (value instanceof ArrayBuffer) {\n return new Uint8Array(value);\n }\n if (value instanceof Uint8Array) {\n return value;\n }\n throw new Error(\"Unrecognized value type, must be one of: string, Buffer, ArrayBuffer, Uint8Array\");\n}\n\n/**\n * Merge two arrays.\n *\n * @param arr1 - First array\n * @param arr2 - Second array\n * @returns Concatenated arrays\n */\nexport function concatUint8Arrays(arr1: Uint8Array, arr2: Uint8Array): Uint8Array {\n const merged = new Uint8Array(arr1.length + arr2.length);\n merged.set(arr1);\n merged.set(arr2, arr1.length);\n return merged;\n}\n\n/**\n * Validates a payload from Discord against its signature and key.\n *\n * @param rawBody - The raw payload data\n * @param signature - The signature from the `X-Signature-Ed25519` header\n * @param timestamp - The timestamp from the `X-Signature-Timestamp` header\n * @param clientPublicKey - The public key from the Discord developer dashboard\n * @returns Whether or not validation was successful\n */\nexport async function verifyKey(\n rawBody: Uint8Array | ArrayBuffer | Buffer | string,\n signature: string | null,\n timestamp: string | null,\n clientPublicKey: string | CryptoKey\n): Promise<boolean> {\n if (!signature || !timestamp) return false;\n try {\n const timestampData = valueToUint8Array(timestamp);\n const bodyData = valueToUint8Array(rawBody);\n const message = concatUint8Arrays(timestampData, bodyData);\n const publicKey =\n typeof clientPublicKey === \"string\"\n ? await subtleCrypto.importKey(\n \"raw\",\n valueToUint8Array(clientPublicKey, \"hex\").buffer as BufferSource,\n {\n name: \"ed25519\",\n },\n false,\n [\"verify\"]\n )\n : clientPublicKey;\n const isValid = await subtleCrypto.verify(\n {\n name: \"ed25519\",\n },\n publicKey,\n valueToUint8Array(signature, \"hex\").buffer as ArrayBuffer,\n message.buffer as ArrayBuffer\n );\n return isValid;\n } catch (_ex) {\n return false;\n }\n}\n\nexport async function verifyDiscordRequest<T extends APIInteraction | APIWebhookEvent = APIInteraction>(\n req: HonoRequest,\n discordPublicKey: string | CryptoKey\n) {\n const signature = req.header(\"x-signature-ed25519\");\n const timestamp = req.header(\"x-signature-timestamp\");\n const body = await (await cloneRawRequest(req)).text();\n const isValidRequest = signature && timestamp && (await verifyKey(body, signature, timestamp, discordPublicKey));\n if (!isValidRequest) {\n return { isValid: false } as const;\n }\n\n return { interaction: JSON.parse(body) as T, isValid: true } as const;\n}\n","// From discord.js\ninterface Colors {\n /** 0x1ABC9C | rgb(26,188,156) */\n Aqua: number;\n /** 0x3498DB | rgb(52,152,219) */\n Blue: number;\n /** 0x5865F2 | rgb(88,101,242) */\n Blurple: number;\n /** 0x11806A | rgb(17,128,106) */\n DarkAqua: number;\n /** 0x206694 | rgb(32,102,148) */\n DarkBlue: number;\n /** 0x2C2F33 | rgb(44,47,51) */\n DarkButNotBlack: number;\n /** 0x7F8C8D | rgb(127,140,141) */\n DarkerGrey: number;\n /** 0xC27C0E | rgb(194,124,14) */\n DarkGold: number;\n /** 0x1F8B4C | rgb(31,139,76) */\n DarkGreen: number;\n /** 0x979C9F | rgb(151,156,159) */\n DarkGrey: number;\n /** 0x2C3E50 | rgb(44,62,80) */\n DarkNavy: number;\n /** 0xA84300 | rgb(168,67,0) */\n DarkOrange: number;\n /** 0x71368A | rgb(113,54,138) */\n DarkPurple: number;\n /** 0x992D22 | rgb(153,45,34) */\n DarkRed: number;\n /** 0xAD1457 | rgb(173,20,87) */\n DarkVividPink: number;\n /** 0x000000 | rgb(0,0,0) */\n Default: number;\n /** 0xEB459E | rgb(235,69,158) */\n Fuchsia: number;\n /** 0xF1C40F | rgb(241,196,15) */\n Gold: number;\n /** 0x57F287 | rgb(87,242,135) */\n Green: number;\n /** 0x95A5A6 | rgb(149,165,166) */\n Grey: number;\n /** 0x99AAb5 | rgb(153,170,181) */\n Greyple: number;\n /** 0xBCC0C0 | rgb(188,192,192) */\n LightGrey: number;\n /** 0xE91E63 | rgb(233,30,99) */\n LuminousVividPink: number;\n /** 0x34495E | rgb(52,73,94) */\n Navy: number;\n /** 0x23272A | rgb(35,39,42) */\n NotQuiteBlack: number;\n /** 0xE67E22 | rgb(230,126,34) */\n Orange: number;\n /** 0x9B59B6 | rgb(155,89,182) */\n Purple: number;\n /** 0xED4245 | rgb(237,66,69) */\n Red: number;\n /** 0xFFFFFF | rgb(255,255,255) */\n White: number;\n /** 0xFEE75C | rgb(254,231,92) */\n Yellow: number;\n}\n\nexport const Colors: Colors = {\n Aqua: 0x1abc9c,\n Blue: 0x3498db,\n Blurple: 0x5865f2,\n DarkAqua: 0x11806a,\n DarkBlue: 0x206694,\n DarkButNotBlack: 0x2c2f33,\n DarkerGrey: 0x7f8c8d,\n DarkGold: 0xc27c0e,\n DarkGreen: 0x1f8b4c,\n DarkGrey: 0x979c9f,\n DarkNavy: 0x2c3e50,\n DarkOrange: 0xa84300,\n DarkPurple: 0x71368a,\n DarkRed: 0x992d22,\n DarkVividPink: 0xad1457,\n Default: 0x000000,\n Fuchsia: 0xeb459e,\n Gold: 0xf1c40f,\n Green: 0x57f287,\n Grey: 0x95a5a6,\n Greyple: 0x99aab5,\n LightGrey: 0xbcc0c0,\n LuminousVividPink: 0xe91e63,\n Navy: 0x34495e,\n NotQuiteBlack: 0x23272a,\n Orange: 0xe67e22,\n Purple: 0x9b59b6,\n Red: 0xed4245,\n White: 0xffffff,\n Yellow: 0xfee75c,\n};\n","import { Handler } from \"@ctx/handlers\";\nimport { API } from \"@discordjs/core/http-only\";\nimport { REST } from \"@discordjs/rest\";\nimport { FlatOrNestedArray } from \"../types\";\n\nexport async function registerCommands(\n token: string | undefined,\n applicationId: string | undefined,\n ...handlers: FlatOrNestedArray<Handler>\n) {\n const flatCommands = handlers.flat(Infinity) as Handler[];\n const commands = flatCommands\n .map((handler) => {\n if (handler.handlerType === \"slash\" || handler.handlerType === \"context\") {\n return handler.toJSON();\n }\n return undefined;\n })\n .filter((cmd) => cmd !== undefined);\n\n if (!token || !applicationId) {\n console.warn(\"Token or Application ID not provided, skipping command registration.\");\n return;\n }\n\n const api = new API(new REST({ version: \"10\" }).setToken(token));\n try {\n await api.applicationCommands.bulkOverwriteGlobalCommands(applicationId, commands);\n console.log(\"---- ✅ Successfully registered global commands ----\");\n } catch (error) {\n console.error(\"---- ❌ Error registering global commands ----\");\n throw error;\n }\n}\n","export * from \"@utils/Colors\";\nexport * from \"@utils/registerCommands\";\n\nexport function parseCustomId(customId: string, onlyPrefix: true): string;\nexport function parseCustomId(\n customId: string,\n onlyPrefix?: false\n): {\n compPath: string[];\n prefix: string;\n lastPathItem: string;\n component: string | null;\n params: string[];\n firstParam: string | null;\n lastParam: string | null;\n};\n\n/**\n * Parses a custom ID into its components.\n *\n * @param customId - The custom ID to parse.\n * @param onlyPrefix - If true, only returns the prefix of the custom ID.\n * @returns An object containing the parsed components or just the prefix.\n *\n * A custom ID is expected to be in the format: \"prefix/component/other/path?param1/param2\"\n */\nexport function parseCustomId(customId: string, onlyPrefix: boolean = false) {\n if (onlyPrefix) {\n const match = customId.match(/^(.+?)(\\/|\\?)/i);\n return match ? match[1] : customId;\n }\n const [path, params] = customId.split(\"?\") as [string, string | undefined];\n const pathS = path.split(\"/\");\n const parms = params?.split(\"/\") || [];\n return {\n compPath: pathS,\n prefix: pathS[0],\n lastPathItem: pathS[pathS.length - 1],\n component: pathS[1] || null,\n params: parms || [],\n firstParam: parms[0] || null,\n lastParam: parms[parms.length - 1] || null,\n };\n}\n","import { APIUserApplicationCommandInteraction, APIUser, ApplicationCommandType } from \"discord-api-types/v10\";\nimport { API } from \"@discordjs/core/http-only\";\nimport { BaseInteractionContext } from \"../types\";\nimport { CommandInteraction } from \"./CommandInteraction\";\n\nclass UserContextInteraction<Context extends BaseInteractionContext = BaseInteractionContext> extends CommandInteraction<\n ApplicationCommandType.User,\n Context\n> {\n public readonly targetUser: APIUser;\n\n constructor(api: API, interaction: APIUserApplicationCommandInteraction, c: Context) {\n super(api, interaction, c);\n this.targetUser = interaction.data.resolved.users[interaction.data.target_id];\n }\n}\n\nexport { UserContextInteraction };\n","import { APIMessage, APIMessageApplicationCommandInteraction, ApplicationCommandType } from \"discord-api-types/v10\";\nimport { API } from \"@discordjs/core/http-only\";\nimport { BaseInteractionContext } from \"../types\";\nimport { CommandInteraction } from \"./CommandInteraction\";\n\nclass MessageContextInteraction<Context extends BaseInteractionContext = BaseInteractionContext> extends CommandInteraction<\n ApplicationCommandType.Message,\n Context\n> {\n public readonly targetMessage: APIMessage;\n\n constructor(api: API, interaction: APIMessageApplicationCommandInteraction, c: Context) {\n super(api, interaction, c);\n this.targetMessage = interaction.data.resolved.messages[interaction.data.target_id];\n }\n}\n\nexport { MessageContextInteraction };\n","import { APIMessage, ComponentType, InteractionType } from \"discord-api-types/v10\";\nimport { API } from \"@discordjs/core/http-only\";\nimport type { BaseInteractionContext, MessageComponentInteractionPayload, MessageComponentType } from \"../types\";\nimport { ModalCapableInteraction } from \"./ModalCapableInteraction\";\n\nclass MessageComponentInteraction<\n T extends MessageComponentType = MessageComponentType,\n Context extends BaseInteractionContext = BaseInteractionContext,\n> extends ModalCapableInteraction<InteractionType.MessageComponent, Context> {\n public readonly message: APIMessage;\n public readonly customId: string;\n public readonly componentType: T;\n\n constructor(api: API, interaction: MessageComponentInteractionPayload<T>, c: Context) {\n super(api, interaction, c);\n this.customId = interaction.data.custom_id;\n this.message = interaction.message;\n this.componentType = interaction.data.component_type as T;\n }\n}\n\nexport { MessageComponentInteraction };\n","import {\n APIInteractionDataResolved,\n APIInteractionDataResolvedChannel,\n APIInteractionDataResolvedGuildMember,\n APIRole,\n APIUser,\n ComponentType,\n ModalSubmitLabelComponent,\n ModalSubmitTextDisplayComponent,\n Snowflake,\n} from \"discord-api-types/v10\";\nimport { APIInteractionDataResolvedCollections } from \"../types\";\nimport { Collection, ReadonlyCollection } from \"@discordjs/collection\";\n\nexport interface BaseModalData<Type extends ComponentType> {\n id?: number;\n type: Type;\n}\n\nexport interface TextInputModalData extends BaseModalData<ComponentType.TextInput> {\n custom_id: string;\n value: string;\n}\n\nexport interface SelectMenuModalData extends BaseModalData<\n | ComponentType.ChannelSelect\n | ComponentType.MentionableSelect\n | ComponentType.RoleSelect\n | ComponentType.StringSelect\n | ComponentType.UserSelect\n> {\n channels?: ReadonlyCollection<Snowflake, APIInteractionDataResolvedChannel>;\n custom_id: string;\n members?: ReadonlyCollection<Snowflake, APIInteractionDataResolvedGuildMember>;\n roles?: ReadonlyCollection<Snowflake, APIRole>;\n users?: ReadonlyCollection<Snowflake, APIUser>;\n /**\n * The raw values selected by the user.\n */\n values: readonly string[];\n}\n\n// Technically, we had to add file uploads too, but we ain't using them anyway\ntype APIModalData = TextInputModalData | SelectMenuModalData;\n\nexport class ModalComponentResolver {\n private _resolved: APIInteractionDataResolvedCollections;\n private hoistedComponents: Collection<string, APIModalData>;\n\n constructor(\n private components: (ModalSubmitLabelComponent | ModalSubmitTextDisplayComponent)[],\n resolved?: APIInteractionDataResolved\n ) {\n this._resolved = Object.keys(resolved ?? {}).reduce((acc, key) => {\n const resolvedData = resolved?.[key as keyof APIInteractionDataResolved];\n const collection = new Collection(resolvedData ? Object.entries(resolvedData) : []);\n acc[key] = collection;\n return acc;\n }, {} as any);\n\n this.hoistedComponents = this.components.reduce(\n (accumulator, next) => {\n // For label components\n if (next.type === ComponentType.Label && next.component.type !== ComponentType.FileUpload) {\n accumulator.set(next.component.custom_id, next.component);\n }\n\n return accumulator;\n },\n new Collection() as Collection<string, APIModalData>\n );\n }\n\n public get data() {\n return this.hoistedComponents.map((component) => component);\n }\n\n getComponent(custom_id: string): APIModalData {\n const component = this.hoistedComponents.get(custom_id);\n\n if (!component) throw new TypeError(\"No component found with the provided custom_id.\");\n\n return component;\n }\n\n /**\n * Gets the value of a text input component.\n *\n * @param custom_id The custom ID of the component.\n * @param required Whether to throw an error if the component is not found or not a text input.\n * @returns The value of the text input, or null if not set and not required.\n */\n getString(custom_id: string, required?: boolean): string | null;\n getString(custom_id: string, required: true): string;\n getString(custom_id: string, required: boolean = false): string | null {\n const component = this.getComponent(custom_id);\n if (component.type !== ComponentType.TextInput) {\n throw new TypeError(\"Component is not a text input\", { cause: { custom_id, type: component.type } });\n }\n return component.value;\n }\n\n /**\n * Gets the selected values of a select menu component.\n *\n * @param custom_id The custom ID of the component.\n * @param required Whether to throw an error if the component is not found or not a select menu.\n * @returns The selected values, or null if not set and not required.\n */\n getSelectedValues(custom_id: string, required?: boolean): readonly string[] | null;\n getSelectedValues(custom_id: string, required: true): readonly string[];\n getSelectedValues(custom_id: string, required: boolean = false): readonly string[] | null {\n const component = this.getComponent(custom_id);\n if (!(\"values\" in component)) {\n throw new TypeError(\"Component is not a select menu\", { cause: { custom_id, type: component.type } });\n }\n return component.values;\n }\n\n /**\n * Gets the selected channels from a channel select menu.\n *\n * @param custom_id The custom ID of the component.\n * @param required Whether to throw an error if the component is not found or not a channel select.\n * @returns The selected channels, or null if not set and not required.\n */\n getSelectedChannels(custom_id: string, required?: boolean): APIInteractionDataResolvedChannel[] | null;\n getSelectedChannels(custom_id: string, required: true): APIInteractionDataResolvedChannel[];\n getSelectedChannels(custom_id: string, required: boolean = false): APIInteractionDataResolvedChannel[] | null {\n const component = this.getComponent(custom_id);\n if (component.type !== ComponentType.ChannelSelect) {\n throw new TypeError(\"Component is not a channel select\", { cause: { custom_id, type: component.type } });\n }\n const values = component.values;\n const channels = values.map((id) => this._resolved.channels?.get(id)).filter(Boolean) as APIInteractionDataResolvedChannel[];\n return channels.length > 0 ? channels : required ? [] : null;\n }\n\n /**\n * Gets the selected users from a user select menu.\n *\n * @param custom_id The custom ID of the component.\n * @param required Whether to throw an error if the component is not found or not a user select.\n * @returns The selected users, or null if not set and not required.\n */\n getSelectedUsers(custom_id: string, required?: boolean): APIUser[] | null;\n getSelectedUsers(custom_id: string, required: true): APIUser[];\n getSelectedUsers(custom_id: string, required: boolean = false): APIUser[] | null {\n const component = this.getComponent(custom_id);\n if (component.type !== ComponentType.UserSelect) {\n throw new TypeError(\"Component is not a user select\", { cause: { custom_id, type: component.type } });\n }\n const values = component.values;\n const users = values.map((id) => this._resolved.users?.get(id)).filter(Boolean) as APIUser[];\n return users.length > 0 ? users : required ? [] : null;\n }\n\n /**\n * Gets the selected members from a user select menu (if in guild).\n *\n * @param custom_id The custom ID of the component.\n * @param required Whether to throw an error if the component is not found or not a user select.\n * @returns The selected members, or null if not set and not required.\n */\n getSelectedMembers(custom_id: string, required?: boolean): APIInteractionDataResolvedGuildMember[] | null;\n getSelectedMembers(custom_id: string, required: true): APIInteractionDataResolvedGuildMember[];\n getSelectedMembers(custom_id: string, required: boolean = false): APIInteractionDataResolvedGuildMember[] | null {\n const component = this.getComponent(custom_id);\n if (component.type !== ComponentType.UserSelect) {\n throw new TypeError(\"Component is not a user select\", { cause: { custom_id, type: component.type } });\n }\n const values = component.values;\n const members = values\n .map((id) => this._resolved.members?.get(id))\n .filter(Boolean) as APIInteractionDataResolvedGuildMember[];\n return members.length > 0 ? members : required ? [] : null;\n }\n\n /**\n * Gets the selected roles from a role select menu.\n *\n * @param custom_id The custom ID of the component.\n * @param required Whether to throw an error if the component is not found or not a role select.\n * @returns The selected roles, or null if not set and not required.\n */\n getSelectedRoles(custom_id: string, required?: boolean): APIRole[] | null;\n getSelectedRoles(custom_id: string, required: true): APIRole[];\n getSelectedRoles(custom_id: string, required: boolean = false): APIRole[] | null {\n const component = this.getComponent(custom_id);\n if (component.type !== ComponentType.RoleSelect) {\n throw new TypeError(\"Component is not a role select\", { cause: { custom_id, type: component.type } });\n }\n const values = component.values;\n const roles = values.map((id) => this._resolved.roles?.get(id)).filter(Boolean) as APIRole[];\n return roles.length > 0 ? roles : required ? [] : null;\n }\n\n /**\n * Gets the selected mentionables from a mentionable select menu.\n *\n * @param custom_id The custom ID of the component.\n * @param required Whether to throw an error if the component is not found or not a mentionable select.\n * @returns The selected mentionables (users, members, or roles), or null if not set and not required.\n */\n getSelectedMentionables(\n custom_id: string,\n required?: boolean\n ): (APIInteractionDataResolvedGuildMember | APIUser | APIRole)[] | null;\n getSelectedMentionables(custom_id: string, required: true): (APIInteractionDataResolvedGuildMember | APIUser | APIRole)[];\n getSelectedMentionables(\n custom_id: string,\n required: boolean = false\n ): (APIInteractionDataResolvedGuildMember | APIUser | APIRole)[] | null {\n const component = this.getComponent(custom_id);\n if (component.type !== ComponentType.MentionableSelect) {\n throw new TypeError(\"Component is not a mentionable select\", { cause: { custom_id, type: component.type } });\n }\n const values = component.values;\n const mentionables: (APIInteractionDataResolvedGuildMember | APIUser | APIRole)[] = [];\n for (const id of values) {\n const member = this._resolved.members?.get(id);\n if (member) mentionables.push(member);\n else {\n const user = this._resolved.users?.get(id);\n if (user) mentionables.push(user);\n else {\n const role = this._resolved.roles?.get(id);\n if (role) mentionables.push(role);\n }\n }\n }\n return mentionables.length > 0 ? mentionables : required ? [] : null;\n }\n}\n","import {\n APIMessage,\n APIModalSubmitInteraction,\n InteractionType,\n ModalSubmitLabelComponent,\n ModalSubmitTextDisplayComponent,\n} from \"discord-api-types/v10\";\nimport { API } from \"@discordjs/core/http-only\";\nimport { ModalComponentResolver } from \"@resolvers/ModalComponentResolver\";\nimport { BaseInteraction } from \"./BaseInteraction\";\nimport { BaseInteractionContext } from \"../types\";\n\nclass ModalInteraction<Context extends BaseInteractionContext = BaseInteractionContext> extends BaseInteraction<\n InteractionType.ModalSubmit,\n Context\n> {\n public readonly fields: ModalComponentResolver;\n public readonly message?: APIMessage;\n public readonly custom_id: string;\n\n constructor(api: API, interaction: APIModalSubmitInteraction, c: Context) {\n super(api, interaction, c);\n this.custom_id = interaction.data.custom_id;\n this.fields = new ModalComponentResolver(\n interaction.data.components as (ModalSubmitLabelComponent | ModalSubmitTextDisplayComponent)[],\n interaction.data.resolved\n );\n if (\"message\" in interaction && interaction.message) {\n this.message = interaction.message;\n }\n }\n}\n\nexport { ModalInteraction };\n","import {\n APIApplicationCommandAutocompleteInteraction,\n APIApplicationCommandOptionChoice,\n InteractionType,\n type APIChatInputApplicationCommandInteraction,\n} from \"discord-api-types/v10\";\nimport { CommandInteractionOptionResolver } from \"@resolvers/CommandOptionResolver\";\nimport { API } from \"@discordjs/core/http-only\";\nimport { BaseInteraction } from \"./BaseInteraction\";\nimport { BaseInteractionContext } from \"../types\";\n\nclass AutocompleteInteraction<Context extends BaseInteractionContext = BaseInteractionContext> extends BaseInteraction<\n InteractionType.ApplicationCommandAutocomplete,\n Context\n> {\n public readonly options: CommandInteractionOptionResolver;\n public responded = false;\n\n constructor(api: API, interaction: APIApplicationCommandAutocompleteInteraction, c: Context) {\n super(api, interaction, c);\n this.options = new CommandInteractionOptionResolver(interaction.data.options, interaction.data.resolved);\n }\n\n get commandName() {\n return this.raw.data.name;\n }\n\n get commandId() {\n return this.raw.data.id;\n }\n\n async respond(choices: APIApplicationCommandOptionChoice[]) {\n await this.api.interactions.createAutocompleteResponse(this.id, this.token, { choices });\n this.responded = true;\n }\n}\n\nexport { AutocompleteInteraction };\n","import type { ChatInputCommandInteraction } from \"./ChatInputInteraction\";\nimport type { AutocompleteInteraction } from \"./AutocompleteInteraction\";\nimport type { MessageComponentInteraction } from \"./MessageComponentInteraction\";\nimport type { ModalInteraction } from \"./ModalInteraction\";\nimport { ContextMenuCommandBuilder, SlashCommandBuilder } from \"@discordjs/builders\";\nimport type {\n SlashCommandBooleanOption,\n SlashCommandUserOption,\n SlashCommandChannelOption,\n SlashCommandRoleOption,\n SlashCommandAttachmentOption,\n SlashCommandMentionableOption,\n SlashCommandStringOption,\n SlashCommandIntegerOption,\n SlashCommandNumberOption,\n SlashCommandSubcommandBuilder,\n SlashCommandSubcommandGroupBuilder,\n} from \"@discordjs/builders\";\nimport { MessageContextInteraction } from \"./MessageContextCommandInteraction\";\nimport { UserContextInteraction } from \"./UserContextCommandInteraction\";\nimport { parseCustomId } from \"@utils/index\";\nimport { AnyInteraction, BaseInteractionContext, ContextCommandType, MessageComponentType } from \"../types\";\nimport { InteractionType } from \"discord-api-types/v10\";\n\n/**\n * Handler for chat input commands with optional autocomplete support\n */\nexport class SlashCommandHandler<Context extends BaseInteractionContext = BaseInteractionContext> extends SlashCommandBuilder {\n readonly handlerType = \"slash\";\n private handlerFn?: (interaction: ChatInputCommandInteraction<Context>) => Promise<any> | any;\n private autocompleteFn?: (interaction: AutocompleteInteraction<Context>) => Promise<any> | any;\n\n /**\n * Adds the command handler function.\n *\n * @param handler The function to handle the command interaction\n * @returns The current SlashCommandHandler instance\n */\n public addHandler(\n handler: (interaction: ChatInputCommandInteraction<Context>) => Promise<any> | any\n ): SlashCommandHandler<Context> {\n this.handlerFn = handler;\n return this;\n }\n\n /**\n * Adds the autocomplete handler function.\n *\n * @param handler The function to handle the autocomplete interaction\n * @returns The current SlashCommandHandler instance\n */\n public addAutocompleteHandler(\n handler: (interaction: AutocompleteInteraction<Context>) => Promise<any> | any\n ): SlashCommandHandler<Context> {\n this.autocompleteFn = handler;\n return this;\n }\n\n /**\n * Executes the command handler\n */\n async execute(interaction: ChatInputCommandInteraction<Context>): Promise<void> {\n if (!this.handlerFn) {\n throw new Error(`Command \"${this.name}\" does not have a handler`);\n }\n await this.handlerFn(interaction);\n }\n\n /**\n * Executes the autocomplete handler if it exists\n */\n async executeAutocomplete(interaction: AutocompleteInteraction<Context>): Promise<void> {\n if (this.autocompleteFn == undefined) {\n throw new Error(`Command \"${this.name}\" does not have an autocomplete handler`);\n }\n await this.autocompleteFn(interaction);\n }\n\n /**\n * Override option/subcommand adders so they return `this` (the handler),\n * preserving chaining when options/subcommands are added.\n */\n addBooleanOption(input: SlashCommandBooleanOption | ((builder: SlashCommandBooleanOption) => SlashCommandBooleanOption)): this {\n super.addBooleanOption(input);\n return this;\n }\n\n addUserOption(input: SlashCommandUserOption | ((builder: SlashCommandUserOption) => SlashCommandUserOption)): this {\n super.addUserOption(input);\n return this;\n }\n\n addChannelOption(input: SlashCommandChannelOption | ((builder: SlashCommandChannelOption) => SlashCommandChannelOption)): this {\n super.addChannelOption(input);\n return this;\n }\n\n addRoleOption(input: SlashCommandRoleOption | ((builder: SlashCommandRoleOption) => SlashCommandRoleOption)): this {\n super.addRoleOption(input);\n return this;\n }\n\n addAttachmentOption(\n input: SlashCommandAttachmentOption | ((builder: SlashCommandAttachmentOption) => SlashCommandAttachmentOption)\n ): this {\n super.addAttachmentOption(input);\n return this;\n }\n\n addMentionableOption(\n input: SlashCommandMentionableOption | ((builder: SlashCommandMentionableOption) => SlashCommandMentionableOption)\n ): this {\n super.addMentionableOption(input);\n return this;\n }\n\n addStringOption(input: SlashCommandStringOption | ((builder: SlashCommandStringOption) => SlashCommandStringOption)): this {\n super.addStringOption(input);\n return this;\n }\n\n addIntegerOption(input: SlashCommandIntegerOption | ((builder: SlashCommandIntegerOption) => SlashCommandIntegerOption)): this {\n super.addIntegerOption(input);\n return this;\n }\n\n addNumberOption(input: SlashCommandNumberOption | ((builder: SlashCommandNumberOption) => SlashCommandNumberOption)): this {\n super.addNumberOption(input);\n return this;\n }\n\n addSubcommand(\n input: SlashCommandSubcommandBuilder | ((sub: SlashCommandSubcommandBuilder) => SlashCommandSubcommandBuilder)\n ): this {\n super.addSubcommand(input);\n return this;\n }\n\n addSubcommandGroup(\n input:\n | SlashCommandSubcommandGroupBuilder\n | ((group: SlashCommandSubcommandGroupBuilder) => SlashCommandSubcommandGroupBuilder)\n ): this {\n super.addSubcommandGroup(input);\n return this;\n }\n}\n\nexport class ContextCommandHandler<\n T extends ContextCommandType = ContextCommandType,\n Context extends BaseInteractionContext = BaseInteractionContext,\n InteractionData = T extends ContextCommandType.User ? UserContextInteraction<Context> : MessageContextInteraction<Context>,\n> extends ContextMenuCommandBuilder {\n readonly handlerType = \"context\";\n private handlerFn?: (interaction: InteractionData) => Promise<any> | any;\n\n public addHandler(\n handler: (interaction: InteractionData) => Promise<any> | any\n ): ContextCommandHandler<T, Context, InteractionData> {\n this.handlerFn = handler;\n return this;\n }\n\n /**\n * Executes the command handler\n */\n async execute(interaction: InteractionData): Promise<void> {\n if (!this.handlerFn) {\n throw new Error(`Command \"${this.name}\" does not have a handler`);\n }\n await this.handlerFn(interaction);\n }\n}\n\n/**\n * Handler for message components (buttons, select menus) based on custom ID prefix\n */\nexport class ComponentHandler<\n T extends MessageComponentType = MessageComponentType,\n Context extends BaseInteractionContext = BaseInteractionContext,\n> {\n readonly handlerType = \"component\";\n public readonly prefix: string;\n private handlerFn?: (interaction: MessageComponentInteraction<T, Context>) => Promise<any> | any;\n\n constructor(prefix: string, handler?: (interaction: MessageComponentInteraction<T, Context>) => Promise<any> | any) {\n if (!prefix || typeof prefix !== \"string\") {\n throw new TypeError(\"Component handler prefix must be a non-empty string\");\n }\n\n this.prefix = prefix;\n if (handler) this.handlerFn = handler;\n }\n\n addHandler(\n handler: (interaction: MessageComponentInteraction<T, Context>) => Promise<any> | any\n ): ComponentHandler<T, Context> {\n this.handlerFn = handler;\n return this;\n }\n\n /**\n * Executes the component handler\n */\n async execute(interaction: MessageComponentInteraction<T, Context>): Promise<void> {\n if (!this.handlerFn) {\n throw new Error(`Component handler with prefix \"${this.prefix}\" does not have a handler`);\n }\n await this.handlerFn(interaction);\n }\n\n /**\n * Checks if this handler matches the given custom ID\n */\n matches(customId: string): boolean {\n const prefix = parseCustomId(customId, true);\n return prefix === this.prefix;\n }\n}\n\n/**\n * Handler for modal submits based on custom ID prefix\n */\nexport class ModalHandler<Context extends BaseInteractionContext = BaseInteractionContext> {\n readonly handlerType = \"modal\";\n public readonly prefix: string;\n private handlerFn?: (interaction: ModalInteraction<Context>) => Promise<any> | any;\n\n constructor(prefix: string, handler?: (interaction: ModalInteraction<Context>) => Promise<any> | any) {\n if (!prefix || typeof prefix !== \"string\") {\n throw new TypeError(\"Modal handler prefix must be a non-empty string\");\n }\n\n this.prefix = prefix;\n if (handler) this.handlerFn = handler;\n }\n\n addHandler(handler: (interaction: ModalInteraction<Context>) => Promise<any> | any): ModalHandler<Context> {\n this.handlerFn = handler;\n return this;\n }\n\n /**\n * Executes the modal handler\n */\n async execute(interaction: ModalInteraction<Context>): Promise<void> {\n if (!this.handlerFn) {\n throw new Error(`Modal handler with prefix \"${this.prefix}\" does not have a handler`);\n }\n await this.handlerFn(interaction);\n }\n\n /**\n * Checks if this handler matches the given custom ID\n */\n matches(customId: string): boolean {\n const prefix = parseCustomId(customId, true);\n return prefix === this.prefix;\n }\n}\n\n/**\n * Union type of all possible handlers\n */\nexport type Handler<Context extends BaseInteractionContext = BaseInteractionContext> =\n | SlashCommandHandler<Context>\n | ContextCommandHandler<ContextCommandType, Context>\n | ComponentHandler<MessageComponentType, Context>\n | ModalHandler<Context>;\n\nexport type CommandHandler<Context extends BaseInteractionContext = BaseInteractionContext> =\n | SlashCommandHandler<Context>\n | ContextCommandHandler<ContextCommandType, Context>;\n","import {\n APIApplicationCommandAutocompleteInteraction,\n APIApplicationCommandInteraction,\n ApplicationCommandType,\n InteractionResponseType,\n InteractionType,\n} from \"discord-api-types/v10\";\nimport { ChatInputCommandInteraction } from \"@ctx/ChatInputInteraction\";\nimport { API } from \"@discordjs/core/http-only\";\nimport { REST } from \"@discordjs/rest\";\nimport { Hono } from \"hono\";\nimport { verifyDiscordRequest } from \"@utils/discordVerify\";\nimport { parseCustomId } from \"@utils/index\";\nimport type {\n BaseVariables,\n BaseInteractionContext,\n ValidInteraction,\n MessageComponentInteractionPayload,\n MessageComponentType,\n FlatOrNestedArray,\n} from \"./types\";\nimport { UserContextInteraction } from \"@ctx/UserContextCommandInteraction\";\nimport { MessageContextInteraction } from \"@ctx/MessageContextCommandInteraction\";\nimport { MessageComponentInteraction } from \"@ctx/MessageComponentInteraction\";\nimport { ModalInteraction } from \"@ctx/ModalInteraction\";\nimport { AutocompleteInteraction } from \"@ctx/AutocompleteInteraction\";\nimport { SlashCommandHandler, ContextCommandHandler, ComponentHandler, ModalHandler, type Handler } from \"@ctx/handlers\";\n\ninterface HonocordOptions {\n /**\n * Indicates whether the Honocord instance is running on Cloudflare Workers.\n *\n * This affects how interactions are processed, allowing for asynchronous handling using the Workers' execution context.\n *\n * @default c.env.IS_CF_WORKER === \"true\" # later determined from environment variable\n */\n isCFWorker?: boolean;\n /**\n * Whether to turn on debug logging for REST API requests.\n *\n * @default false\n */\n debugRest?: boolean;\n}\n\nexport class Honocord {\n private commandHandlers = new Map<string, SlashCommandHandler | ContextCommandHandler>();\n private componentHandlers = new Map<string, ComponentHandler>();\n private modalHandlers = new Map<string, ModalHandler>();\n private isCFWorker: boolean;\n private debugRest: boolean;\n\n constructor({ isCFWorker, debugRest }: HonocordOptions = {}) {\n this.isCFWorker = isCFWorker ?? false;\n this.debugRest = debugRest ?? false;\n }\n\n /**\n * Registers handlers for interactions.\n *\n * @param handlers - Array of CommandHandler, ComponentHandler, or ModalHandler instances\n *\n * For an example of usage, see the [Example Repository](https://github.com/The-LukeZ/honocord-examples).\n */\n loadHandlers(...handlers: FlatOrNestedArray<Handler>): void {\n const flattenedHandlers = handlers.flat(Infinity) as Handler[];\n\n for (const handler of flattenedHandlers) {\n if (handler instanceof SlashCommandHandler || handler instanceof ContextCommandHandler) {\n if (this.commandHandlers.has(handler.name)) {\n console.warn(`Command handler for \"${handler.name}\" already exists. Overwriting.`);\n }\n this.commandHandlers.set(handler.name, handler);\n } else if (handler instanceof ComponentHandler) {\n const prefix = handler.prefix;\n if (this.componentHandlers.has(prefix)) {\n console.warn(`Component handler with prefix \"${prefix}\" already exists. Overwriting.`);\n }\n this.componentHandlers.set(prefix, handler);\n } else if (handler instanceof ModalHandler) {\n const prefix = handler.prefix;\n if (this.modalHandlers.has(prefix)) {\n console.warn(`Modal handler with prefix \"${prefix}\" already exists. Overwriting.`);\n }\n this.modalHandlers.set(prefix, handler);\n }\n }\n }\n\n private createCommandInteraction(ctx: BaseInteractionContext, interaction: APIApplicationCommandInteraction, api: API) {\n switch (interaction.data.type) {\n case ApplicationCommandType.ChatInput:\n return new ChatInputCommandInteraction(api, interaction as any, ctx);\n case ApplicationCommandType.User:\n return new UserContextInteraction(api, interaction as any, ctx);\n case ApplicationCommandType.Message:\n return new MessageContextInteraction(api, interaction as any, ctx);\n default:\n throw new Error(\n `Unsupported application command type: ${interaction.data.type} (${ApplicationCommandType[interaction.data.type]})`\n );\n }\n }\n\n private async handleCommandInteraction(ctx: BaseInteractionContext, interaction: APIApplicationCommandInteraction, api: API) {\n const interactionObj = this.createCommandInteraction(ctx, interaction, api);\n const commandName = interaction.data.name;\n const handler = this.commandHandlers.get(commandName);\n\n if (handler) {\n try {\n if (handler instanceof SlashCommandHandler && interaction.data.type === ApplicationCommandType.ChatInput) {\n await handler.execute(interactionObj as ChatInputCommandInteraction);\n } else if (handler instanceof ContextCommandHandler) {\n if (interaction.data.type === ApplicationCommandType.User) {\n await handler.execute(interactionObj as UserContextInteraction);\n } else if (interaction.data.type === ApplicationCommandType.Message) {\n await handler.execute(interactionObj as MessageContextInteraction);\n }\n }\n } catch (error) {\n console.error(`Error executing command handler for \"${commandName}\":`, error);\n throw error;\n }\n }\n\n return interactionObj;\n }\n\n private async handleAutocompleteInteraction(\n ctx: BaseInteractionContext,\n interaction: APIApplicationCommandAutocompleteInteraction,\n api: API\n ) {\n const interactionObj = new AutocompleteInteraction(api, interaction, ctx);\n const commandName = interaction.data.name;\n const handler = this.commandHandlers.get(commandName);\n\n if (handler && handler instanceof SlashCommandHandler) {\n try {\n await handler.executeAutocomplete(interactionObj);\n } catch (error) {\n console.error(`Error executing autocomplete handler for \"${commandName}\":`, error);\n throw error;\n }\n }\n\n return interactionObj;\n }\n\n private async handleComponentInteraction<T extends MessageComponentType>(\n ctx: BaseInteractionContext,\n interaction: MessageComponentInteractionPayload<T>,\n api: API\n ) {\n const interactionObj = new MessageComponentInteraction<T>(api, interaction, ctx);\n const prefix = parseCustomId(interaction.data.custom_id, true);\n\n // Lookup handler by prefix\n const handler = this.componentHandlers.get(prefix);\n if (handler) {\n try {\n await handler.execute(interactionObj);\n } catch (error) {\n console.error(`Error executing component handler for prefix \"${prefix}\":`, error);\n throw error;\n }\n }\n\n return interactionObj;\n }\n\n private async handleModalInteraction(\n ctx: BaseInteractionContext,\n interaction: Extract<ValidInteraction, { type: InteractionType.ModalSubmit }>,\n api: API\n ) {\n const interactionObj = new ModalInteraction(api, interaction, ctx);\n const customId = interaction.data.custom_id;\n const prefix = parseCustomId(customId, true);\n\n // Lookup handler by prefix\n const handler = this.modalHandlers.get(prefix);\n\n if (handler) {\n try {\n await handler.execute(interactionObj);\n } catch (error) {\n console.error(`Error executing modal handler for prefix \"${prefix}\":`, error);\n throw error;\n }\n }\n\n return interactionObj;\n }\n\n private async createInteraction(ctx: BaseInteractionContext, interaction: ValidInteraction) {\n const rest = new REST({ authPrefix: \"Bot\" }).setToken(ctx.env.DISCORD_TOKEN as string);\n if (this.debugRest) {\n rest\n .addListener(\"response\", (request, response) => {\n console.debug(\n `[REST] ${request.method} ${request.path} -> ${response.status} ${response.statusText} (${request.route})`\n );\n })\n .addListener(\"restDebug\", (info) => {\n console.debug(`[REST DEBUG] ${info}`);\n });\n }\n const api = new API(rest);\n\n switch (interaction.type) {\n case InteractionType.ApplicationCommand:\n return await this.handleCommandInteraction(ctx, interaction, api);\n case InteractionType.MessageComponent:\n return await this.handleComponentInteraction(ctx, interaction, api);\n case InteractionType.ModalSubmit:\n return await this.handleModalInteraction(ctx, interaction, api);\n case InteractionType.ApplicationCommandAutocomplete:\n return await this.handleAutocompleteInteraction(ctx, interaction, api);\n default:\n throw new Error(`Unknown interaction type: ${(interaction as any).type} (${InteractionType[(interaction as any).type]})`);\n }\n }\n\n /**\n * Returns a Hono handler for POST Requests handling Discord interactions.\n *\n * @example\n * ```typescript\n * import { Hono } from \"hono\";\n * import { Honocord } from \"honocord\";\n *\n * const app = new Hono();\n * const bot = new Honocord();\n *\n * app.get(\"/\", (c) => c.text(\"🔥 Honocord is running!\"));\n * app.post(\"/interactions\", bot.handle);\n *\n * export default app;\n * ```\n */\n handle = async (c: BaseInteractionContext) => {\n // Check if running on CF Workers\n const isCFWorker = this.isCFWorker || c.env.IS_CF_WORKER === \"true\";\n\n // Verify the request\n const { isValid, interaction } = await verifyDiscordRequest(c.req, c.env.DISCORD_PUBLIC_KEY as string);\n if (!isValid) {\n return c.text(\"Bad request signature.\", 401);\n } else if (!interaction) {\n console.log(\"No interaction found in request\");\n return c.text(\"No interaction found.\", 400);\n }\n\n if (interaction.type === InteractionType.Ping) {\n console.log(\"Received Discord Ping\");\n return c.json({ type: InteractionResponseType.Pong });\n }\n\n // Handle CF Workers execution context\n if (isCFWorker && c.executionCtx?.waitUntil) {\n // Process interaction asynchronously\n c.executionCtx.waitUntil(\n new Promise(async (resolve) => {\n try {\n await this.createInteraction(c, interaction);\n } catch (error) {\n console.error(\"Error handling interaction:\", error);\n }\n resolve(undefined);\n })\n );\n return c.json({}, 202); // Accepted for processing\n }\n\n // Standard non-CF Workers execution\n try {\n await this.createInteraction(c, interaction);\n } catch (error) {\n console.error(\"Error handling interaction:\", error);\n return c.text(\"Internal server error.\", 500);\n }\n };\n\n /**\n * Returns a Hono App instance with the interaction handler mounted at the root path and a GET Handler for all paths, which returns a simple Health response.\n *\n * @example\n * ```typescript\n * import { Honocord } from \"honocord\";\n *\n * const honoCord = new Honocord();\n *\n * export default honoCord.getApp();\n * ```\n */\n getApp() {\n const app = new Hono<{ Variables: BaseVariables }>();\n app.get(\"*\", (c) => c.text(\"🔥 Honocord is running!\"));\n app.post(\"/\", this.handle);\n return app;\n }\n}\n"],"mappings":";;;;;;;;;;;;AAqCA,IAAM,mCAAN,MAAuC;;;;CAIrC,AAAQ,SAAwB;;;;CAIhC,AAAQ,cAA6B;;;;;CAKrC,AAAQ;CAIR,AAAQ;CAER,YACE,SAKA,UACA;AACA,OAAK,kBAAkB,WAAW,EAAE;AACpC,OAAK,YAAY,OAAO,KAAK,YAAY,EAAE,CAAC,CAAC,QAAQ,KAAK,QAAQ;GAChE,MAAM,eAAe,WAAW;AAEhC,OAAI,OADe,IAAIA,aAAW,eAAe,OA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,MAAM,aAAa,KAAK,cAAc,EAAE,IAAI,iBAAiB;EAG7D,MAAM,EAAE,SAAS,gBAAgB,MAAM,qBAAqB,EAAE,KAAK,EAAE,IAAI,mBAA6B;AACtG,MAAI,CAAC,QACH,QAAO,EAAE,KAAK,0BAA0B,IAAI;WACnC,CAAC,aAAa;AACvB,WAAQ,IAAI,kCAAkC;AAC9C,UAAO,EAAE,KAAK,yBAAyB,IAAI;;AAG7C,MAAI,YAAY,SAASA,kBAAgB,MAAM;AAC7C,WAAQ,IAAI,wBAAwB;AACpC,UAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,MAAM,CAAC;;AAIvD,MAAI,cAAc,EAAE,cAAc,WAAW;AAE3C,KAAE,aAAa,UACb,IAAI,QAAQ,OAAO,YAAY;AAC7B,QAAI;AACF,WAAM,KAAK,kBAAkB,GAAG,YAAY;aACrC,OAAO;AACd,aAAQ,MAAM,+BAA+B,MAAM;;AAErD,YAAQ,OAAU;KAClB,CACH;AACD,UAAO,EAAE,KAAK,EAAE,EAAE,IAAI;;AAIxB,MAAI;AACF,SAAM,KAAK,kBAAkB,GAAG,YAAY;WACrC,OAAO;AACd,WAAQ,MAAM,+BAA+B,MAAM;AACnD,UAAO,EAAE,KAAK,0BAA0B,IAAI;;;;;;;;;;;;;;;CAgBhD,SAAS;EACP,MAAM,MAAM,IAAI,MAAoC;AACpD,MAAI,IAAI,MAAM,MAAM,EAAE,KAAK,0BAA0B,CAAC;AACtD,MAAI,KAAK,KAAK,KAAK,OAAO;AAC1B,SAAO"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["Collection","InteractionType","ApplicationCommandType","ComponentType","ModalBuilder","Collection","ComponentType","ApplicationCommandType","InteractionType"],"sources":["../src/resolvers/CommandOptionResolver.ts","../src/interactions/BaseInteraction.ts","../src/interactions/ModalCapableInteraction.ts","../src/interactions/CommandInteraction.ts","../src/interactions/ChatInputInteraction.ts","../src/utils/discordVerify.ts","../src/utils/Colors.ts","../src/utils/registerCommands.ts","../src/utils/index.ts","../src/interactions/UserContextCommandInteraction.ts","../src/interactions/MessageContextCommandInteraction.ts","../src/interactions/MessageComponentInteraction.ts","../src/resolvers/ModalComponentResolver.ts","../src/interactions/ModalInteraction.ts","../src/interactions/AutocompleteInteraction.ts","../src/interactions/handlers.ts","../src/Honocord.ts"],"sourcesContent":["import { Collection } from \"@discordjs/collection\";\nimport {\n APIApplicationCommandInteractionDataOption,\n APIAttachment,\n APIInteractionDataResolved,\n APIInteractionDataResolvedChannel,\n APIInteractionDataResolvedGuildMember,\n APIRole,\n APIUser,\n ApplicationCommandOptionType,\n ChannelType,\n InteractionType,\n} from \"discord-api-types/v10\";\nimport { APIInteractionDataResolvedCollections } from \"../types\";\n\ntype AutocompleteFocusedOption = {\n /**\n * The name of the option.\n */\n name: string;\n /**\n * The type of the application command option.\n */\n type: ApplicationCommandOptionType;\n /**\n * The value of the option.\n */\n value: string;\n /**\n * Whether the option is focused.\n */\n focused: boolean;\n};\n\n/**\n * A resolver for command interaction options.\n */\nclass CommandInteractionOptionResolver {\n /**\n * The name of the subcommand group.\n */\n private _group: string | null = null;\n /**\n * The name of the subcommand.\n */\n private _subcommand: string | null = null;\n /**\n * The bottom-level options for the interaction.\n * If there is a subcommand (or subcommand and group), this is the options for the subcommand.\n */\n private _hoistedOptions: APIApplicationCommandInteractionDataOption<\n InteractionType.ApplicationCommand | InteractionType.ApplicationCommandAutocomplete\n >[];\n\n private _resolved: APIInteractionDataResolvedCollections;\n\n constructor(\n options:\n | APIApplicationCommandInteractionDataOption<\n InteractionType.ApplicationCommand | InteractionType.ApplicationCommandAutocomplete\n >[]\n | undefined,\n resolved: APIInteractionDataResolved | undefined\n ) {\n this._hoistedOptions = options ?? [];\n this._resolved = Object.keys(resolved ?? {}).reduce((acc, key) => {\n const resolvedData = resolved?.[key as keyof APIInteractionDataResolved];\n const collection = new Collection(resolvedData ? Object.entries(resolvedData) : []);\n acc[key as keyof APIInteractionDataResolvedCollections] = collection;\n return acc;\n }, {} as Partial<APIInteractionDataResolvedCollections>);\n\n // Hoist subcommand group if present\n if (this._hoistedOptions[0]?.type === ApplicationCommandOptionType.SubcommandGroup) {\n this._group = this._hoistedOptions[0].name;\n this._hoistedOptions = this._hoistedOptions[0].options ?? [];\n }\n\n // Hoist subcommand if present\n if (this._hoistedOptions[0]?.type === ApplicationCommandOptionType.Subcommand) {\n this._subcommand = this._hoistedOptions[0].name;\n this._hoistedOptions = this._hoistedOptions[0].options ?? [];\n }\n }\n\n public get data() {\n return this._hoistedOptions;\n }\n\n /**\n * Gets an option by its name.\n *\n * @param name The name of the option.\n * @param type The expected type of the option.\n * @param required Whether to throw an error if the option is not found.\n * @returns The option, if found.\n */\n get<T extends ApplicationCommandOptionType>(name: string, type: T, required = false) {\n const option = this._hoistedOptions.find((opt) => opt.name === name);\n if (!option) {\n if (required) {\n throw new TypeError(\"Option not found\", { cause: { name } });\n }\n\n return null;\n }\n\n if (option.type !== type) {\n throw new TypeError(\"Option type mismatch\", { cause: { name, type: option.type, expected: type } });\n }\n\n return option as Extract<APIApplicationCommandInteractionDataOption<InteractionType.ApplicationCommand>, { type: T }>;\n }\n\n /**\n * Gets the selected subcommand.\n *\n * @param {boolean} [required=true] Whether to throw an error if there is no subcommand.\n * @returns {?string} The name of the selected subcommand, or null if not set and not required.\n */\n getSubcommand(): string | null;\n getSubcommand(required: true): string;\n getSubcommand(required: boolean = true): string | null {\n if (required && !this._subcommand) {\n throw new TypeError(\"No subcommand selected\");\n }\n\n return this._subcommand;\n }\n\n /**\n * Gets the selected subcommand group.\n *\n * @param required Whether to throw an error if there is no subcommand group.\n * @returns The name of the selected subcommand group, or null if not set and not required.\n */\n getSubcommandGroup(required?: boolean): string | null;\n getSubcommandGroup(required: true): string;\n getSubcommandGroup(required: boolean = false): string | null {\n if (required && !this._group) {\n throw new TypeError(\"No subcommand group selected\");\n }\n\n return this._group;\n }\n\n getFocused(): AutocompleteFocusedOption | null {\n return (this._hoistedOptions as AutocompleteFocusedOption[]).find((option) => option.focused) || null;\n }\n\n /**\n * Gets a boolean option.\n *\n * @param name The name of the option.\n * @param required Whether to throw an error if the option is not found.\n * @returns The value of the option, or null if not set and not required.\n */\n getBoolean(name: string, required?: boolean): boolean | null;\n getBoolean(name: string, required: true): boolean;\n getBoolean(name: string, required: boolean = false): boolean | null {\n const option = this.get(name, ApplicationCommandOptionType.Boolean, required);\n return option ? option.value : null;\n }\n\n /**\n * Gets a channel option.\n *\n * @param name The name of the option.\n * @param required Whether to throw an error if the option is not found.\n * @param channelTypes The allowed types of channels. If empty, all channel types are allowed.\n * @returns The value of the option, or null if not set and not required.\n */\n getChannel(name: string, required: false, channelTypes: ChannelType[]): APIInteractionDataResolvedChannel | null;\n getChannel(name: string, required: true, channelTypes: ChannelType[]): APIInteractionDataResolvedChannel;\n getChannel(\n name: string,\n required: boolean = false,\n channelTypes: ChannelType[] = []\n ): APIInteractionDataResolvedChannel | null {\n const option = this.get(name, ApplicationCommandOptionType.Channel, required);\n const channel = option ? this._resolved.channels?.get(option.value) || null : null;\n\n if (channel && channelTypes.length > 0 && !channelTypes.includes(channel.type)) {\n throw new TypeError(\"Invalid channel type\", { cause: { name, type: channel.type, expected: channelTypes.join(\", \") } });\n }\n\n return channel;\n }\n\n /**\n * Gets a string option.\n *\n * @param name The name of the option.\n * @param required Whether to throw an error if the option is not found.\n * @returns The value of the option, or null if not set and not required.\n */\n getString<T extends string = string>(name: string, required?: boolean): T | null;\n getString<T extends string = string>(name: string, required: true): T;\n getString<T extends string = string>(name: string, required: boolean = false): T | null {\n const option = this.get(name, ApplicationCommandOptionType.String, required);\n return (option?.value as T) ?? null;\n }\n\n /**\n * Gets an integer option.\n *\n * @param name The name of the option.\n * @param required Whether to throw an error if the option is not found.\n * @returns The value of the option, or null if not set and not required.\n */\n getInteger(name: string, required?: boolean): number | null;\n getInteger(name: string, required: true): number;\n getInteger(name: string, required: boolean = false): number | null {\n const option = this.get(name, ApplicationCommandOptionType.Integer, required);\n return option?.value ?? null;\n }\n\n /**\n * Gets a number option.\n *\n * @param name The name of the option.\n * @param required Whether to throw an error if the option is not found.\n * @returns The value of the option, or null if not set and not required.\n */\n getNumber(name: string, required?: boolean): number | null;\n getNumber(name: string, required: true): number;\n getNumber(name: string, required: boolean = false): number | null {\n const option = this.get(name, ApplicationCommandOptionType.Number, required);\n return option?.value ?? null;\n }\n\n /**\n * Gets a user option.\n *\n * @param name The name of the option.\n * @param required Whether to throw an error if the option is not found.\n * @returns The value of the option, or null if not set and not required.\n */\n getUser(name: string, required?: boolean): APIUser | null;\n getUser(name: string, required: true): APIUser;\n getUser(name: string, required: boolean = false): APIUser | null {\n const option = this.get(name, ApplicationCommandOptionType.User, required);\n const user = option ? this._resolved.users?.get(option.value) || null : null;\n return user;\n }\n\n /**\n * Gets a member option.\n *\n * @param name The name of the option.\n * @returns The value of the option, or null if the user is not present in the guild or the option is not set.\n */\n getMember(name: string, required?: boolean): APIInteractionDataResolvedGuildMember | null;\n getMember(name: string, required: true): APIInteractionDataResolvedGuildMember;\n getMember(name: string, required: boolean = false): APIInteractionDataResolvedGuildMember | null {\n const option = this.get(name, ApplicationCommandOptionType.User, required);\n const member = option ? this._resolved.members?.get(option.value) || null : null;\n return member;\n }\n\n /**\n * Gets a role option.\n *\n * @param name The name of the option.\n * @param required Whether to throw an error if the option is not found.\n * @returns The value of the option, or null if not set and not required.\n */\n getRole(name: string, required?: boolean): APIRole | null;\n getRole(name: string, required: true): APIRole;\n getRole(name: string, required: boolean = false): APIRole | null {\n const option = this.get(name, ApplicationCommandOptionType.Role, required);\n const role = option ? this._resolved.roles?.get(option.value) || null : null;\n return role;\n }\n\n /**\n * Gets an attachment option.\n *\n * @param name The name of the option.\n * @param required Whether to throw an error if the option is not found.\n * @returns The value of the option, or null if not set and not required.\n */\n getAttachment(name: string, required?: boolean): APIAttachment | null;\n getAttachment(name: string, required: true): APIAttachment;\n getAttachment(name: string, required: boolean = false): APIAttachment | null {\n const option = this.get(name, ApplicationCommandOptionType.Attachment, required);\n const attachment = option ? this._resolved.attachments?.get(option.value) || null : null;\n return attachment;\n }\n\n /**\n * Gets a mentionable option.\n *\n * @param name The name of the option.\n * @param required Whether to throw an error if the option is not found.\n * @returns The value of the option, or null if not set and not required.\n */\n getMentionable(name: string, required?: boolean): APIInteractionDataResolvedGuildMember | APIUser | APIRole | null;\n getMentionable(name: string, required: true): APIInteractionDataResolvedGuildMember | APIUser | APIRole;\n getMentionable(name: string, required: boolean = false): (APIInteractionDataResolvedGuildMember | APIUser | APIRole) | null {\n const option = this.get(name, ApplicationCommandOptionType.Mentionable, required);\n const user = option ? this._resolved.users?.get(option.value) || null : null;\n const member = option ? this._resolved.members?.get(option.value) || null : null;\n const role = option ? this._resolved.roles?.get(option.value) || null : null;\n return member ?? user ?? role ?? null;\n }\n}\n\nexport { CommandInteractionOptionResolver };\n","import {\n type Snowflake,\n APIInteractionResponseCallbackData,\n APIPartialInteractionGuild,\n APIUser,\n ApplicationCommandType,\n InteractionType,\n Locale,\n APIApplicationCommandInteraction,\n ComponentType,\n APIMessageComponentInteraction,\n} from \"discord-api-types/v10\";\nimport { API } from \"@discordjs/core/http-only\";\nimport { REST } from \"@discordjs/rest\";\nimport { ModalInteraction } from \"./ModalInteraction\";\nimport type {\n BaseInteractionContext,\n InteractionResponseCallbackData,\n JSONEncodable,\n MessageComponentType,\n ValidInteraction,\n} from \"../types\";\nimport { MessageComponentInteraction } from \"./MessageComponentInteraction\";\nimport { AutocompleteInteraction } from \"./AutocompleteInteraction\";\nimport { CommandInteraction } from \"./CommandInteraction\";\nimport { ChatInputCommandInteraction } from \"./ChatInputInteraction\";\nimport { UserContextInteraction } from \"./UserContextCommandInteraction\";\nimport { MessageContextInteraction } from \"./MessageContextCommandInteraction\";\n\nfunction snakeCase(str: string): string {\n return str\n .replace(/([a-z0-9])([A-Z])/g, \"$1_$2\")\n .replace(/([A-Z])([A-Z][a-z])/g, \"$1_$2\")\n .toLowerCase();\n}\n\n/**\n * Transforms camel-cased keys into snake cased keys\n *\n * @param {*} obj The object to transform\n * @returns {*} The transformed object\n */\nfunction toSnakeCase(obj: any): any {\n if (typeof obj !== \"object\" || !obj) return obj;\n if (obj instanceof Date) return obj;\n if (isJSONEncodable(obj)) return toSnakeCase(obj.toJSON());\n if (Array.isArray(obj)) return obj.map(toSnakeCase);\n return Object.fromEntries(Object.entries(obj).map(([key, value]) => [snakeCase(key), toSnakeCase(value)]));\n}\n\n/**\n * Indicates if an object is encodable or not.\n *\n * @param maybeEncodable - The object to check against\n */\nfunction isJSONEncodable(maybeEncodable: unknown): maybeEncodable is JSONEncodable<unknown> {\n return (\n maybeEncodable !== null &&\n typeof maybeEncodable === \"object\" &&\n \"toJSON\" in maybeEncodable &&\n typeof maybeEncodable[\"toJSON\"] === \"function\"\n );\n}\n\nabstract class BaseInteraction<Type extends InteractionType, Context extends BaseInteractionContext = BaseInteractionContext> {\n public readonly type: Type;\n /** The raw interaction data */\n protected readonly raw: Extract<ValidInteraction, { type: Type }>;\n public readonly rest: REST;\n protected _ephemeral: boolean | null = null;\n protected replied: boolean = false;\n protected deferred: boolean = false;\n public readonly context: Context;\n\n constructor(\n protected api: API,\n data: Extract<ValidInteraction, { type: Type }>,\n context: Context\n ) {\n this.type = data.type as Type;\n this.raw = { ...data };\n this.rest = api.rest;\n this.context = context;\n }\n\n get applicationId() {\n return this.raw.application_id;\n }\n\n get entitlements() {\n return this.raw.entitlements;\n }\n\n get channelId() {\n return this.raw.channel?.id;\n }\n\n get channel() {\n return this.raw.channel;\n }\n\n get guildId() {\n return this.raw.guild_id;\n }\n\n get guild() {\n return this.raw.guild;\n }\n\n get userId() {\n return this.raw.user?.id;\n }\n\n get user() {\n return (this.raw.member?.user || this.raw.user) as APIUser; // One is always given.\n }\n\n get member() {\n return this.raw.member;\n }\n\n get locale() {\n return this.raw.guild_locale;\n }\n\n get guildLocale() {\n return this.raw.guild_locale;\n }\n\n get token() {\n return this.raw.token;\n }\n\n get id() {\n return this.raw.id;\n }\n\n get appPermissions() {\n return this.raw.app_permissions;\n }\n\n get version() {\n return this.raw.version;\n }\n\n protected isJSONEncodable(obj: unknown): obj is JSONEncodable<unknown> {\n return isJSONEncodable(obj);\n }\n\n protected toSnakeCase(obj: unknown): unknown {\n return toSnakeCase(obj);\n }\n\n inGuild(): this is BaseInteraction<Type> & { guild_id: Snowflake; guild: APIPartialInteractionGuild; guild_locale: Locale } {\n return Boolean(this.raw.guild_id && this.raw.guild && this.raw.guild_locale);\n }\n\n inDM(): this is BaseInteraction<Type> & { guild_id: undefined; guild: undefined; guild_locale: undefined } {\n return !this.inGuild();\n }\n\n getAppEntitlements() {\n return this.entitlements.filter((entitlement) => entitlement.application_id === this.applicationId);\n }\n\n guildHavePremium(): boolean {\n return (\n this.getAppEntitlements().filter(\n (entitlement) =>\n entitlement.guild_id === this.guildId && (!entitlement.ends_at || new Date(entitlement.ends_at) > new Date())\n ).length > 0\n );\n }\n\n userHavePremium(): boolean {\n return (\n this.getAppEntitlements().filter(\n (entitlement) =>\n entitlement.user_id === this.userId && (!entitlement.ends_at || new Date(entitlement.ends_at) > new Date())\n ).length > 0\n );\n }\n\n private prepareResponsePayload(options: InteractionResponseCallbackData): APIInteractionResponseCallbackData {\n return this.toSnakeCase({\n ...options,\n components: options.components?.map((component) => (this.isJSONEncodable(component) ? component.toJSON() : component)),\n embeds: options.embeds?.map((embed) => (this.isJSONEncodable(embed) ? embed.toJSON() : embed)),\n }) as APIInteractionResponseCallbackData;\n }\n\n async reply(options: InteractionResponseCallbackData | string, forceEphemeral = true) {\n const replyOptions = typeof options === \"string\" ? { content: options } : options;\n if (forceEphemeral) {\n replyOptions.flags = (replyOptions.flags ?? 0) | 64;\n }\n const response = await this.api.interactions.reply(\n this.id,\n this.token,\n { ...this.prepareResponsePayload(replyOptions), with_response: true },\n {\n signal: AbortSignal.timeout(5000),\n }\n );\n this.replied = true;\n return response;\n }\n\n async deferReply(forceEphemeral = true) {\n const response = await this.api.interactions.defer(this.id, this.token, {\n flags: forceEphemeral ? 64 : undefined,\n with_response: true,\n });\n this.deferred = true;\n return response;\n }\n\n /**\n * Defers the update of a component interaction.\n *\n * @returns A promise that resolves when the update is deferred\n *\n * Responding to a component interaction via the deferUpdate() method acknowledges the interaction and resets the message state.\n * This method can be used to suppress the need for further responses, however it's encouraged to provide meaningful feedback to users via an update() or ephemeral reply() at least.\\\n * Once deferUpdate() has been called, future messages can be sent by calling followUp() or edits can be made by calling editReply() on the component interaction.\n *\n * Example flow:\n * 1. User clicks a button.\n * 2. Bot calls `deferUpdate()` to acknowledge the interaction.\n * 3. Bot performs some processing.\n * 4. Bot calls `editReply()` to update the original message.\n *\n */\n deferUpdate() {\n return this.api.interactions.deferMessageUpdate(this.id, this.token, { with_response: true });\n }\n\n /**\n * Edits the original interaction response.\n *\n * @param options - The options to edit the message with\n * @param messageId - The message id to edit, defaults to `@original`\n * @returns The edited message\n *\n * This is used to edit the original interaction response message.\n *\n * Before using this method, the interaction needs to be replied to first before using this method - with `reply`, `deferReply` or `update`.\n */\n async editReply(options: InteractionResponseCallbackData | string, messageId: Snowflake | \"@original\" = \"@original\") {\n const replyOptions = typeof options === \"string\" ? { content: options } : options;\n const response = await this.api.interactions.editReply(\n this.applicationId,\n this.token,\n this.prepareResponsePayload(replyOptions),\n messageId,\n {\n signal: AbortSignal.timeout(5000),\n }\n );\n this.replied = true;\n return response;\n }\n\n /**\n * Deletes the original interaction response (or a follow-up message).\n *\n * @param messageId - The message id to delete, defaults to `@original`\n * @returns A promise that resolves when the message is deleted\n *\n * This is used to delete the original interaction response message or a follow-up message.\n */\n deleteReply(messageId?: Snowflake | \"@original\") {\n return this.api.interactions.deleteReply(this.applicationId, this.token, messageId);\n }\n\n /**\n * Updates the original interaction response.\n *\n * @param options - The options to update the message with\n * @returns The updated message\n *\n * This is mainly used for component interactions where you want to update the message the component is attached to OR for\n * moodal submit interactions to update the message that opened the modal.\n *\n * After calling this method, the interaction is considered replied and you need to use `editReply` to edit the original response.\n */\n async update(options: InteractionResponseCallbackData | string) {\n const updateOptions = typeof options === \"string\" ? { content: options } : options;\n const response = await this.api.interactions.updateMessage(\n this.id,\n this.token,\n { ...this.prepareResponsePayload(updateOptions), with_response: true },\n {\n signal: AbortSignal.timeout(5000),\n }\n );\n this.replied = true;\n return response;\n }\n\n /**\n * Sends a follow-up message to the interaction.\n *\n * @param options - The options to send the follow-up message with\n * @param forceEphemeral - Whether to force the message to be ephemeral\n * @returns The sent follow-up message\n *\n * This is used to send additional messages after the initial interaction response.\n */\n async followUp(options: InteractionResponseCallbackData | string, forceEphemeral = false) {\n const followUpOptions = typeof options === \"string\" ? { content: options } : options;\n if (forceEphemeral) {\n followUpOptions.flags = (followUpOptions.flags ?? 0) | 64;\n }\n const response = await this.api.interactions.followUp(\n this.applicationId,\n this.token,\n this.prepareResponsePayload(followUpOptions),\n {\n signal: AbortSignal.timeout(5000),\n }\n );\n return response;\n }\n\n // Typeguards\n isCommand(): this is CommandInteraction<ApplicationCommandType, Context> {\n return this.raw.type === InteractionType.ApplicationCommand;\n }\n\n isChatInputCommand(): this is ChatInputCommandInteraction<Context> {\n return (\n this.raw.type === InteractionType.ApplicationCommand &&\n (this.raw as APIApplicationCommandInteraction).data.type === ApplicationCommandType.ChatInput\n );\n }\n\n isUserContextCommand(): this is UserContextInteraction<Context> {\n return (\n this.raw.type === InteractionType.ApplicationCommand &&\n (this.raw as APIApplicationCommandInteraction).data.type === ApplicationCommandType.User\n );\n }\n\n isMessageContextCommand(): this is MessageContextInteraction<Context> {\n return (\n this.raw.type === InteractionType.ApplicationCommand &&\n (this.raw as APIApplicationCommandInteraction).data.type === ApplicationCommandType.Message\n );\n }\n\n isModal(): this is ModalInteraction {\n return this.raw.type === InteractionType.ModalSubmit;\n }\n\n isMessageComponent(): this is MessageComponentInteraction<MessageComponentType, Context> {\n return this.raw.type === InteractionType.MessageComponent;\n }\n\n isButton(): this is MessageComponentInteraction<ComponentType.Button, Context> {\n return this.isMessageComponent() && this.raw.data.component_type === ComponentType.Button;\n }\n\n isStringSelect(): this is MessageComponentInteraction<ComponentType.StringSelect, Context> {\n return this.isMessageComponent() && this.raw.data.component_type === ComponentType.StringSelect;\n }\n\n isUserSelect(): this is MessageComponentInteraction<ComponentType.UserSelect, Context> {\n return this.isMessageComponent() && this.raw.data.component_type === ComponentType.UserSelect;\n }\n\n isRoleSelect(): this is MessageComponentInteraction<ComponentType.RoleSelect, Context> {\n return this.isMessageComponent() && this.raw.data.component_type === ComponentType.RoleSelect;\n }\n\n isMentionableSelect(): this is MessageComponentInteraction<ComponentType.MentionableSelect, Context> {\n return this.isMessageComponent() && this.raw.data.component_type === ComponentType.MentionableSelect;\n }\n\n isChannelSelect(): this is MessageComponentInteraction<ComponentType.ChannelSelect, Context> {\n return this.isMessageComponent() && this.raw.data.component_type === ComponentType.ChannelSelect;\n }\n\n isAutocomplete(): this is AutocompleteInteraction<Context> & { type: InteractionType.ApplicationCommandAutocomplete } {\n return this.raw.type === InteractionType.ApplicationCommandAutocomplete;\n }\n}\n\nexport { BaseInteraction };\n","import { InteractionType } from \"discord-api-types/v10\";\nimport { ModalBuilder } from \"@discordjs/builders\";\nimport { BaseInteraction } from \"./BaseInteraction\";\nimport type { BaseInteractionContext, ModalInteractionResponseCallbackData } from \"../types\";\n\nclass ModalCapableInteraction<\n Type extends InteractionType,\n Context extends BaseInteractionContext = BaseInteractionContext,\n> extends BaseInteraction<Type, Context> {\n /**\n * Responds to the interaction with a modal.\n *\n * @param data - The modal data to send\n */\n showModal(data: ModalInteractionResponseCallbackData | ModalBuilder) {\n const responseData = {\n ...(data instanceof ModalBuilder ? data.toJSON() : data),\n components:\n data instanceof ModalBuilder\n ? data.components.map((row) => row.toJSON())\n : data.components.map((row) => (this.isJSONEncodable(row) ? row.toJSON() : row)),\n };\n return this.api.interactions.createModal(this.id, this.token, responseData);\n }\n}\n\nexport { ModalCapableInteraction };\n","import { APIApplicationCommandInteraction, ApplicationCommandType, InteractionType } from \"discord-api-types/v10\";\nimport { API } from \"@discordjs/core/http-only\";\nimport { BaseInteractionContext } from \"../types\";\nimport { ModalCapableInteraction } from \"./ModalCapableInteraction\";\n\nabstract class CommandInteraction<\n CType extends ApplicationCommandType = ApplicationCommandType,\n Context extends BaseInteractionContext = BaseInteractionContext,\n> extends ModalCapableInteraction<InteractionType.ApplicationCommand, Context> {\n public readonly commandType: CType;\n\n constructor(api: API, interaction: Extract<APIApplicationCommandInteraction, { data: { type: CType } }>, c: Context) {\n super(api, interaction, c);\n this.commandType = interaction.data.type;\n }\n\n get commandName() {\n return this.raw.data.name;\n }\n\n get commandId() {\n return this.raw.data.id;\n }\n\n isOfType<T extends ApplicationCommandType>(type: T): this is CommandInteraction<T, Context> {\n return (this.commandType as ApplicationCommandType) === type;\n }\n}\n\nexport { CommandInteraction };\n","import { ApplicationCommandType, type APIChatInputApplicationCommandInteraction } from \"discord-api-types/v10\";\nimport { CommandInteractionOptionResolver } from \"@resolvers/CommandOptionResolver\";\nimport { API } from \"@discordjs/core/http-only\";\nimport { BaseInteractionContext } from \"../types\";\nimport { CommandInteraction } from \"./CommandInteraction\";\n\nclass ChatInputCommandInteraction<Context extends BaseInteractionContext = BaseInteractionContext> extends CommandInteraction<\n ApplicationCommandType.ChatInput,\n Context\n> {\n public readonly options: CommandInteractionOptionResolver;\n\n constructor(api: API, interaction: APIChatInputApplicationCommandInteraction, c: Context) {\n super(api, interaction, c);\n this.options = new CommandInteractionOptionResolver(interaction.data.options, interaction.data.resolved);\n }\n}\n\nexport { ChatInputCommandInteraction };\n","import type { APIInteraction, APIWebhookEvent } from \"discord-api-types/v10\";\nimport { cloneRawRequest, type HonoRequest } from \"hono/request\";\nimport { BufferSource } from \"../types\";\n\nexport const subtleCrypto = crypto.subtle;\n\n/**\n * Converts different types to Uint8Array.\n *\n * @param value - Value to convert. Strings are parsed as hex.\n * @param format - Format of value. Valid options: 'hex'. Defaults to utf-8.\n * @returns Value in Uint8Array form.\n */\nexport function valueToUint8Array(value: Uint8Array | ArrayBuffer | Buffer | string, format?: string): Uint8Array {\n if (value == null) {\n return new Uint8Array();\n }\n if (typeof value === \"string\") {\n if (format === \"hex\") {\n const matches = value.match(/.{1,2}/g);\n if (matches == null) {\n throw new Error(\"Value is not a valid hex string\");\n }\n const hexVal = matches.map((byte: string) => Number.parseInt(byte, 16));\n return new Uint8Array(hexVal);\n }\n\n return new TextEncoder().encode(value);\n }\n try {\n if (Buffer.isBuffer(value)) {\n return new Uint8Array(value);\n }\n } catch (_ex) {\n // Runtime doesn't have Buffer\n }\n if (value instanceof ArrayBuffer) {\n return new Uint8Array(value);\n }\n if (value instanceof Uint8Array) {\n return value;\n }\n throw new Error(\"Unrecognized value type, must be one of: string, Buffer, ArrayBuffer, Uint8Array\");\n}\n\n/**\n * Merge two arrays.\n *\n * @param arr1 - First array\n * @param arr2 - Second array\n * @returns Concatenated arrays\n */\nexport function concatUint8Arrays(arr1: Uint8Array, arr2: Uint8Array): Uint8Array {\n const merged = new Uint8Array(arr1.length + arr2.length);\n merged.set(arr1);\n merged.set(arr2, arr1.length);\n return merged;\n}\n\n/**\n * Validates a payload from Discord against its signature and key.\n *\n * @param rawBody - The raw payload data\n * @param signature - The signature from the `X-Signature-Ed25519` header\n * @param timestamp - The timestamp from the `X-Signature-Timestamp` header\n * @param clientPublicKey - The public key from the Discord developer dashboard\n * @returns Whether or not validation was successful\n */\nexport async function verifyKey(\n rawBody: Uint8Array | ArrayBuffer | Buffer | string,\n signature: string | null,\n timestamp: string | null,\n clientPublicKey: string | CryptoKey\n): Promise<boolean> {\n if (!signature || !timestamp) return false;\n try {\n const timestampData = valueToUint8Array(timestamp);\n const bodyData = valueToUint8Array(rawBody);\n const message = concatUint8Arrays(timestampData, bodyData);\n const publicKey =\n typeof clientPublicKey === \"string\"\n ? await subtleCrypto.importKey(\n \"raw\",\n valueToUint8Array(clientPublicKey, \"hex\").buffer as BufferSource,\n {\n name: \"ed25519\",\n },\n false,\n [\"verify\"]\n )\n : clientPublicKey;\n const isValid = await subtleCrypto.verify(\n {\n name: \"ed25519\",\n },\n publicKey,\n valueToUint8Array(signature, \"hex\").buffer as ArrayBuffer,\n message.buffer as ArrayBuffer\n );\n return isValid;\n } catch (_ex) {\n return false;\n }\n}\n\nexport async function verifyDiscordRequest<T extends APIInteraction | APIWebhookEvent = APIInteraction>(\n req: HonoRequest,\n discordPublicKey: string | CryptoKey\n) {\n const signature = req.header(\"x-signature-ed25519\");\n const timestamp = req.header(\"x-signature-timestamp\");\n const body = await (await cloneRawRequest(req)).text();\n const isValidRequest = signature && timestamp && (await verifyKey(body, signature, timestamp, discordPublicKey));\n if (!isValidRequest) {\n return { isValid: false } as const;\n }\n\n return { interaction: JSON.parse(body) as T, isValid: true } as const;\n}\n","// From discord.js\ninterface Colors {\n /** 0x1ABC9C | rgb(26,188,156) */\n Aqua: number;\n /** 0x3498DB | rgb(52,152,219) */\n Blue: number;\n /** 0x5865F2 | rgb(88,101,242) */\n Blurple: number;\n /** 0x11806A | rgb(17,128,106) */\n DarkAqua: number;\n /** 0x206694 | rgb(32,102,148) */\n DarkBlue: number;\n /** 0x2C2F33 | rgb(44,47,51) */\n DarkButNotBlack: number;\n /** 0x7F8C8D | rgb(127,140,141) */\n DarkerGrey: number;\n /** 0xC27C0E | rgb(194,124,14) */\n DarkGold: number;\n /** 0x1F8B4C | rgb(31,139,76) */\n DarkGreen: number;\n /** 0x979C9F | rgb(151,156,159) */\n DarkGrey: number;\n /** 0x2C3E50 | rgb(44,62,80) */\n DarkNavy: number;\n /** 0xA84300 | rgb(168,67,0) */\n DarkOrange: number;\n /** 0x71368A | rgb(113,54,138) */\n DarkPurple: number;\n /** 0x992D22 | rgb(153,45,34) */\n DarkRed: number;\n /** 0xAD1457 | rgb(173,20,87) */\n DarkVividPink: number;\n /** 0x000000 | rgb(0,0,0) */\n Default: number;\n /** 0xEB459E | rgb(235,69,158) */\n Fuchsia: number;\n /** 0xF1C40F | rgb(241,196,15) */\n Gold: number;\n /** 0x57F287 | rgb(87,242,135) */\n Green: number;\n /** 0x95A5A6 | rgb(149,165,166) */\n Grey: number;\n /** 0x99AAb5 | rgb(153,170,181) */\n Greyple: number;\n /** 0xBCC0C0 | rgb(188,192,192) */\n LightGrey: number;\n /** 0xE91E63 | rgb(233,30,99) */\n LuminousVividPink: number;\n /** 0x34495E | rgb(52,73,94) */\n Navy: number;\n /** 0x23272A | rgb(35,39,42) */\n NotQuiteBlack: number;\n /** 0xE67E22 | rgb(230,126,34) */\n Orange: number;\n /** 0x9B59B6 | rgb(155,89,182) */\n Purple: number;\n /** 0xED4245 | rgb(237,66,69) */\n Red: number;\n /** 0xFFFFFF | rgb(255,255,255) */\n White: number;\n /** 0xFEE75C | rgb(254,231,92) */\n Yellow: number;\n}\n\nexport const Colors: Colors = {\n Aqua: 0x1abc9c,\n Blue: 0x3498db,\n Blurple: 0x5865f2,\n DarkAqua: 0x11806a,\n DarkBlue: 0x206694,\n DarkButNotBlack: 0x2c2f33,\n DarkerGrey: 0x7f8c8d,\n DarkGold: 0xc27c0e,\n DarkGreen: 0x1f8b4c,\n DarkGrey: 0x979c9f,\n DarkNavy: 0x2c3e50,\n DarkOrange: 0xa84300,\n DarkPurple: 0x71368a,\n DarkRed: 0x992d22,\n DarkVividPink: 0xad1457,\n Default: 0x000000,\n Fuchsia: 0xeb459e,\n Gold: 0xf1c40f,\n Green: 0x57f287,\n Grey: 0x95a5a6,\n Greyple: 0x99aab5,\n LightGrey: 0xbcc0c0,\n LuminousVividPink: 0xe91e63,\n Navy: 0x34495e,\n NotQuiteBlack: 0x23272a,\n Orange: 0xe67e22,\n Purple: 0x9b59b6,\n Red: 0xed4245,\n White: 0xffffff,\n Yellow: 0xfee75c,\n};\n","import { Handler } from \"@ctx/handlers\";\nimport { API } from \"@discordjs/core/http-only\";\nimport { REST } from \"@discordjs/rest\";\nimport { FlatOrNestedArray } from \"../types\";\nimport type { RESTPostAPIApplicationCommandsJSONBody, RESTPostAPIApplicationGuildCommandsJSONBody } from \"discord-api-types/v10\";\n\nexport async function registerCommands(\n token: string | undefined,\n applicationId: string | undefined,\n ...handlers: FlatOrNestedArray<Handler>\n) {\n const flatCommands = handlers.flat(Infinity) as Handler[];\n const { globalCommands, guildCommands } = flatCommands\n .map((handler) => {\n if (handler.handlerType === \"slash\" || handler.handlerType === \"context\") {\n return handler;\n }\n return undefined;\n })\n .filter((cmd) => cmd !== undefined)\n .reduce(\n (acc, cmd) => {\n if (cmd.isGuildCommand()) {\n for (const guildId of cmd.guildIds.values()) {\n if (!acc.guildCommands[guildId]) {\n acc.guildCommands[guildId] = [];\n }\n acc.guildCommands[guildId].push(cmd.toJSON());\n }\n } else {\n acc.globalCommands.push(cmd.toJSON());\n }\n return acc;\n },\n {\n globalCommands: [] as RESTPostAPIApplicationCommandsJSONBody[],\n guildCommands: {} as Record<string, RESTPostAPIApplicationGuildCommandsJSONBody[]>,\n }\n );\n\n if (!token || !applicationId) {\n console.warn(\"Token or Application ID not provided, skipping command registration.\");\n return;\n }\n\n const api = new API(new REST({ version: \"10\" }).setToken(token));\n try {\n await api.applicationCommands.bulkOverwriteGlobalCommands(applicationId, globalCommands);\n console.log(`---- ✅ Successfully registered ${globalCommands.length} global commands ----`);\n } catch (error) {\n console.error(\"---- ❌ Error registering global commands ----\");\n throw error;\n }\n\n if (Object.keys(guildCommands).length === 0) {\n return;\n }\n\n const guildCommandsArray = Object.entries(guildCommands).map(([guildId, commands]) => ({ guildId, commands }));\n\n for (const { guildId, commands } of guildCommandsArray) {\n try {\n await api.applicationCommands.bulkOverwriteGuildCommands(applicationId, guildId, commands);\n console.log(`---- ✅ Successfully registered ${commands.length} guild commands for guild ${guildId} ----`);\n } catch (error) {\n console.error(`---- ❌ Error registering guild commands for guild ${guildId} ----`);\n throw error;\n }\n }\n}\n","export * from \"@utils/Colors\";\nexport * from \"@utils/registerCommands\";\n\nexport function parseCustomId(customId: string, onlyPrefix: true): string;\nexport function parseCustomId(\n customId: string,\n onlyPrefix?: false\n): {\n compPath: string[];\n prefix: string;\n lastPathItem: string;\n component: string | null;\n params: string[];\n firstParam: string | null;\n lastParam: string | null;\n};\n\n/**\n * Parses a custom ID into its components.\n *\n * @param customId - The custom ID to parse.\n * @param onlyPrefix - If true, only returns the prefix of the custom ID.\n * @returns An object containing the parsed components or just the prefix.\n *\n * A custom ID is expected to be in the format: \"prefix/component/other/path?param1/param2\"\n */\nexport function parseCustomId(customId: string, onlyPrefix: boolean = false) {\n if (onlyPrefix) {\n const match = customId.match(/^(.+?)(\\/|\\?)/i);\n return match ? match[1] : customId;\n }\n const [path, params] = customId.split(\"?\") as [string, string | undefined];\n const pathS = path.split(\"/\");\n const parms = params?.split(\"/\") || [];\n return {\n compPath: pathS,\n prefix: pathS[0],\n lastPathItem: pathS[pathS.length - 1],\n component: pathS[1] || null,\n params: parms || [],\n firstParam: parms[0] || null,\n lastParam: parms[parms.length - 1] || null,\n };\n}\n","import { APIUserApplicationCommandInteraction, APIUser, ApplicationCommandType } from \"discord-api-types/v10\";\nimport { API } from \"@discordjs/core/http-only\";\nimport { BaseInteractionContext } from \"../types\";\nimport { CommandInteraction } from \"./CommandInteraction\";\n\nclass UserContextInteraction<Context extends BaseInteractionContext = BaseInteractionContext> extends CommandInteraction<\n ApplicationCommandType.User,\n Context\n> {\n public readonly targetUser: APIUser;\n\n constructor(api: API, interaction: APIUserApplicationCommandInteraction, c: Context) {\n super(api, interaction, c);\n this.targetUser = interaction.data.resolved.users[interaction.data.target_id];\n }\n}\n\nexport { UserContextInteraction };\n","import { APIMessage, APIMessageApplicationCommandInteraction, ApplicationCommandType } from \"discord-api-types/v10\";\nimport { API } from \"@discordjs/core/http-only\";\nimport { BaseInteractionContext } from \"../types\";\nimport { CommandInteraction } from \"./CommandInteraction\";\n\nclass MessageContextInteraction<Context extends BaseInteractionContext = BaseInteractionContext> extends CommandInteraction<\n ApplicationCommandType.Message,\n Context\n> {\n public readonly targetMessage: APIMessage;\n\n constructor(api: API, interaction: APIMessageApplicationCommandInteraction, c: Context) {\n super(api, interaction, c);\n this.targetMessage = interaction.data.resolved.messages[interaction.data.target_id];\n }\n}\n\nexport { MessageContextInteraction };\n","import { APIMessage, ComponentType, InteractionType } from \"discord-api-types/v10\";\nimport { API } from \"@discordjs/core/http-only\";\nimport type { BaseInteractionContext, MessageComponentInteractionPayload, MessageComponentType } from \"../types\";\nimport { ModalCapableInteraction } from \"./ModalCapableInteraction\";\n\nclass MessageComponentInteraction<\n T extends MessageComponentType = MessageComponentType,\n Context extends BaseInteractionContext = BaseInteractionContext,\n> extends ModalCapableInteraction<InteractionType.MessageComponent, Context> {\n public readonly message: APIMessage;\n public readonly customId: string;\n public readonly componentType: T;\n\n constructor(api: API, interaction: MessageComponentInteractionPayload<T>, c: Context) {\n super(api, interaction, c);\n this.customId = interaction.data.custom_id;\n this.message = interaction.message;\n this.componentType = interaction.data.component_type as T;\n }\n}\n\nexport { MessageComponentInteraction };\n","import {\n APIInteractionDataResolved,\n APIInteractionDataResolvedChannel,\n APIInteractionDataResolvedGuildMember,\n APIRole,\n APIUser,\n ComponentType,\n ModalSubmitLabelComponent,\n ModalSubmitTextDisplayComponent,\n Snowflake,\n} from \"discord-api-types/v10\";\nimport { APIInteractionDataResolvedCollections } from \"../types\";\nimport { Collection, ReadonlyCollection } from \"@discordjs/collection\";\n\nexport interface BaseModalData<Type extends ComponentType> {\n id?: number;\n type: Type;\n}\n\nexport interface TextInputModalData extends BaseModalData<ComponentType.TextInput> {\n custom_id: string;\n value: string;\n}\n\nexport interface SelectMenuModalData extends BaseModalData<\n | ComponentType.ChannelSelect\n | ComponentType.MentionableSelect\n | ComponentType.RoleSelect\n | ComponentType.StringSelect\n | ComponentType.UserSelect\n> {\n channels?: ReadonlyCollection<Snowflake, APIInteractionDataResolvedChannel>;\n custom_id: string;\n members?: ReadonlyCollection<Snowflake, APIInteractionDataResolvedGuildMember>;\n roles?: ReadonlyCollection<Snowflake, APIRole>;\n users?: ReadonlyCollection<Snowflake, APIUser>;\n /**\n * The raw values selected by the user.\n */\n values: readonly string[];\n}\n\n// Technically, we had to add file uploads too, but we ain't using them anyway\ntype APIModalData = TextInputModalData | SelectMenuModalData;\n\nexport class ModalComponentResolver {\n private _resolved: APIInteractionDataResolvedCollections;\n private hoistedComponents: Collection<string, APIModalData>;\n\n constructor(\n private components: (ModalSubmitLabelComponent | ModalSubmitTextDisplayComponent)[],\n resolved?: APIInteractionDataResolved\n ) {\n this._resolved = Object.keys(resolved ?? {}).reduce((acc, key) => {\n const resolvedData = resolved?.[key as keyof APIInteractionDataResolved];\n const collection = new Collection(resolvedData ? Object.entries(resolvedData) : []);\n acc[key] = collection;\n return acc;\n }, {} as any);\n\n this.hoistedComponents = this.components.reduce(\n (accumulator, next) => {\n // For label components\n if (next.type === ComponentType.Label && next.component.type !== ComponentType.FileUpload) {\n accumulator.set(next.component.custom_id, next.component);\n }\n\n return accumulator;\n },\n new Collection() as Collection<string, APIModalData>\n );\n }\n\n public get data() {\n return this.hoistedComponents.map((component) => component);\n }\n\n getComponent(custom_id: string): APIModalData {\n const component = this.hoistedComponents.get(custom_id);\n\n if (!component) throw new TypeError(\"No component found with the provided custom_id.\");\n\n return component;\n }\n\n /**\n * Gets the value of a text input component.\n *\n * @param custom_id The custom ID of the component.\n * @param required Whether to throw an error if the component is not found or not a text input.\n * @returns The value of the text input, or null if not set and not required.\n */\n getString(custom_id: string, required?: boolean): string | null;\n getString(custom_id: string, required: true): string;\n getString(custom_id: string, required: boolean = false): string | null {\n const component = this.getComponent(custom_id);\n if (component.type !== ComponentType.TextInput) {\n throw new TypeError(\"Component is not a text input\", { cause: { custom_id, type: component.type } });\n }\n return component.value;\n }\n\n /**\n * Gets the selected values of a select menu component.\n *\n * @param custom_id The custom ID of the component.\n * @param required Whether to throw an error if the component is not found or not a select menu.\n * @returns The selected values, or null if not set and not required.\n */\n getSelectedValues(custom_id: string, required?: boolean): readonly string[] | null;\n getSelectedValues(custom_id: string, required: true): readonly string[];\n getSelectedValues(custom_id: string, required: boolean = false): readonly string[] | null {\n const component = this.getComponent(custom_id);\n if (!(\"values\" in component)) {\n throw new TypeError(\"Component is not a select menu\", { cause: { custom_id, type: component.type } });\n }\n return component.values;\n }\n\n /**\n * Gets the selected channels from a channel select menu.\n *\n * @param custom_id The custom ID of the component.\n * @param required Whether to throw an error if the component is not found or not a channel select.\n * @returns The selected channels, or null if not set and not required.\n */\n getSelectedChannels(custom_id: string, required?: boolean): APIInteractionDataResolvedChannel[] | null;\n getSelectedChannels(custom_id: string, required: true): APIInteractionDataResolvedChannel[];\n getSelectedChannels(custom_id: string, required: boolean = false): APIInteractionDataResolvedChannel[] | null {\n const component = this.getComponent(custom_id);\n if (component.type !== ComponentType.ChannelSelect) {\n throw new TypeError(\"Component is not a channel select\", { cause: { custom_id, type: component.type } });\n }\n const values = component.values;\n const channels = values.map((id) => this._resolved.channels?.get(id)).filter(Boolean) as APIInteractionDataResolvedChannel[];\n return channels.length > 0 ? channels : required ? [] : null;\n }\n\n /**\n * Gets the selected users from a user select menu.\n *\n * @param custom_id The custom ID of the component.\n * @param required Whether to throw an error if the component is not found or not a user select.\n * @returns The selected users, or null if not set and not required.\n */\n getSelectedUsers(custom_id: string, required?: boolean): APIUser[] | null;\n getSelectedUsers(custom_id: string, required: true): APIUser[];\n getSelectedUsers(custom_id: string, required: boolean = false): APIUser[] | null {\n const component = this.getComponent(custom_id);\n if (component.type !== ComponentType.UserSelect) {\n throw new TypeError(\"Component is not a user select\", { cause: { custom_id, type: component.type } });\n }\n const values = component.values;\n const users = values.map((id) => this._resolved.users?.get(id)).filter(Boolean) as APIUser[];\n return users.length > 0 ? users : required ? [] : null;\n }\n\n /**\n * Gets the selected members from a user select menu (if in guild).\n *\n * @param custom_id The custom ID of the component.\n * @param required Whether to throw an error if the component is not found or not a user select.\n * @returns The selected members, or null if not set and not required.\n */\n getSelectedMembers(custom_id: string, required?: boolean): APIInteractionDataResolvedGuildMember[] | null;\n getSelectedMembers(custom_id: string, required: true): APIInteractionDataResolvedGuildMember[];\n getSelectedMembers(custom_id: string, required: boolean = false): APIInteractionDataResolvedGuildMember[] | null {\n const component = this.getComponent(custom_id);\n if (component.type !== ComponentType.UserSelect) {\n throw new TypeError(\"Component is not a user select\", { cause: { custom_id, type: component.type } });\n }\n const values = component.values;\n const members = values\n .map((id) => this._resolved.members?.get(id))\n .filter(Boolean) as APIInteractionDataResolvedGuildMember[];\n return members.length > 0 ? members : required ? [] : null;\n }\n\n /**\n * Gets the selected roles from a role select menu.\n *\n * @param custom_id The custom ID of the component.\n * @param required Whether to throw an error if the component is not found or not a role select.\n * @returns The selected roles, or null if not set and not required.\n */\n getSelectedRoles(custom_id: string, required?: boolean): APIRole[] | null;\n getSelectedRoles(custom_id: string, required: true): APIRole[];\n getSelectedRoles(custom_id: string, required: boolean = false): APIRole[] | null {\n const component = this.getComponent(custom_id);\n if (component.type !== ComponentType.RoleSelect) {\n throw new TypeError(\"Component is not a role select\", { cause: { custom_id, type: component.type } });\n }\n const values = component.values;\n const roles = values.map((id) => this._resolved.roles?.get(id)).filter(Boolean) as APIRole[];\n return roles.length > 0 ? roles : required ? [] : null;\n }\n\n /**\n * Gets the selected mentionables from a mentionable select menu.\n *\n * @param custom_id The custom ID of the component.\n * @param required Whether to throw an error if the component is not found or not a mentionable select.\n * @returns The selected mentionables (users, members, or roles), or null if not set and not required.\n */\n getSelectedMentionables(\n custom_id: string,\n required?: boolean\n ): (APIInteractionDataResolvedGuildMember | APIUser | APIRole)[] | null;\n getSelectedMentionables(custom_id: string, required: true): (APIInteractionDataResolvedGuildMember | APIUser | APIRole)[];\n getSelectedMentionables(\n custom_id: string,\n required: boolean = false\n ): (APIInteractionDataResolvedGuildMember | APIUser | APIRole)[] | null {\n const component = this.getComponent(custom_id);\n if (component.type !== ComponentType.MentionableSelect) {\n throw new TypeError(\"Component is not a mentionable select\", { cause: { custom_id, type: component.type } });\n }\n const values = component.values;\n const mentionables: (APIInteractionDataResolvedGuildMember | APIUser | APIRole)[] = [];\n for (const id of values) {\n const member = this._resolved.members?.get(id);\n if (member) mentionables.push(member);\n else {\n const user = this._resolved.users?.get(id);\n if (user) mentionables.push(user);\n else {\n const role = this._resolved.roles?.get(id);\n if (role) mentionables.push(role);\n }\n }\n }\n return mentionables.length > 0 ? mentionables : required ? [] : null;\n }\n}\n","import {\n APIMessage,\n APIModalSubmitInteraction,\n InteractionType,\n ModalSubmitLabelComponent,\n ModalSubmitTextDisplayComponent,\n} from \"discord-api-types/v10\";\nimport { API } from \"@discordjs/core/http-only\";\nimport { ModalComponentResolver } from \"@resolvers/ModalComponentResolver\";\nimport { BaseInteraction } from \"./BaseInteraction\";\nimport { BaseInteractionContext } from \"../types\";\n\nclass ModalInteraction<Context extends BaseInteractionContext = BaseInteractionContext> extends BaseInteraction<\n InteractionType.ModalSubmit,\n Context\n> {\n public readonly fields: ModalComponentResolver;\n public readonly message?: APIMessage;\n public readonly custom_id: string;\n\n constructor(api: API, interaction: APIModalSubmitInteraction, c: Context) {\n super(api, interaction, c);\n this.custom_id = interaction.data.custom_id;\n this.fields = new ModalComponentResolver(\n interaction.data.components as (ModalSubmitLabelComponent | ModalSubmitTextDisplayComponent)[],\n interaction.data.resolved\n );\n if (\"message\" in interaction && interaction.message) {\n this.message = interaction.message;\n }\n }\n}\n\nexport { ModalInteraction };\n","import {\n APIApplicationCommandAutocompleteInteraction,\n APIApplicationCommandOptionChoice,\n InteractionType,\n type APIChatInputApplicationCommandInteraction,\n} from \"discord-api-types/v10\";\nimport { CommandInteractionOptionResolver } from \"@resolvers/CommandOptionResolver\";\nimport { API } from \"@discordjs/core/http-only\";\nimport { BaseInteraction } from \"./BaseInteraction\";\nimport { BaseInteractionContext } from \"../types\";\n\nclass AutocompleteInteraction<Context extends BaseInteractionContext = BaseInteractionContext> extends BaseInteraction<\n InteractionType.ApplicationCommandAutocomplete,\n Context\n> {\n public readonly options: CommandInteractionOptionResolver;\n public responded = false;\n\n constructor(api: API, interaction: APIApplicationCommandAutocompleteInteraction, c: Context) {\n super(api, interaction, c);\n this.options = new CommandInteractionOptionResolver(interaction.data.options, interaction.data.resolved);\n }\n\n get commandName() {\n return this.raw.data.name;\n }\n\n get commandId() {\n return this.raw.data.id;\n }\n\n async respond(choices: APIApplicationCommandOptionChoice[]) {\n await this.api.interactions.createAutocompleteResponse(this.id, this.token, { choices });\n this.responded = true;\n }\n}\n\nexport { AutocompleteInteraction };\n","import type { ChatInputCommandInteraction } from \"./ChatInputInteraction\";\nimport type { AutocompleteInteraction } from \"./AutocompleteInteraction\";\nimport type { MessageComponentInteraction } from \"./MessageComponentInteraction\";\nimport type { ModalInteraction } from \"./ModalInteraction\";\nimport { ContextMenuCommandBuilder, SlashCommandBuilder } from \"@discordjs/builders\";\nimport type {\n SlashCommandBooleanOption,\n SlashCommandUserOption,\n SlashCommandChannelOption,\n SlashCommandRoleOption,\n SlashCommandAttachmentOption,\n SlashCommandMentionableOption,\n SlashCommandStringOption,\n SlashCommandIntegerOption,\n SlashCommandNumberOption,\n SlashCommandSubcommandBuilder,\n SlashCommandSubcommandGroupBuilder,\n} from \"@discordjs/builders\";\nimport { MessageContextInteraction } from \"./MessageContextCommandInteraction\";\nimport { UserContextInteraction } from \"./UserContextCommandInteraction\";\nimport { parseCustomId } from \"@utils/index\";\nimport { BaseInteractionContext, ContextCommandType, MessageComponentType } from \"../types\";\n\n/**\n * Handler for chat input commands with optional autocomplete support\n */\nexport class SlashCommandHandler<Context extends BaseInteractionContext = BaseInteractionContext> extends SlashCommandBuilder {\n readonly handlerType = \"slash\";\n private handlerFn?: (interaction: ChatInputCommandInteraction<Context>) => Promise<any> | any;\n private autocompleteFn?: (interaction: AutocompleteInteraction<Context>) => Promise<any> | any;\n /**\n * Set of guild IDs where this command is registered (empty for global commands)\n */\n readonly guildIds = new Set<string>();\n\n isGuildCommand(): boolean {\n return this.guildIds.size > 0;\n }\n\n setGuildIds(guildIds: string[]): this {\n this.guildIds.clear();\n for (const guildId of guildIds) {\n this.guildIds.add(guildId);\n }\n return this;\n }\n\n addGuildIds(...guildIds: string[]): this {\n for (const guildId of guildIds) {\n this.guildIds.add(guildId);\n }\n return this;\n }\n\n removeGuildIds(...guildIds: string[]): this {\n for (const guildId of guildIds) {\n this.guildIds.delete(guildId);\n }\n return this;\n }\n\n /**\n * Adds the command handler function.\n *\n * @param handler The function to handle the command interaction\n * @returns The current SlashCommandHandler instance\n */\n public addHandler(\n handler: (interaction: ChatInputCommandInteraction<Context>) => Promise<any> | any\n ): SlashCommandHandler<Context> {\n this.handlerFn = handler;\n return this;\n }\n\n /**\n * Adds the autocomplete handler function.\n *\n * @param handler The function to handle the autocomplete interaction\n * @returns The current SlashCommandHandler instance\n */\n public addAutocompleteHandler(\n handler: (interaction: AutocompleteInteraction<Context>) => Promise<any> | any\n ): SlashCommandHandler<Context> {\n this.autocompleteFn = handler;\n return this;\n }\n\n /**\n * Executes the command handler\n */\n async execute(interaction: ChatInputCommandInteraction<Context>): Promise<void> {\n if (!this.handlerFn) {\n throw new Error(`Command \"${this.name}\" does not have a handler`);\n }\n await this.handlerFn(interaction);\n }\n\n /**\n * Executes the autocomplete handler if it exists\n */\n async executeAutocomplete(interaction: AutocompleteInteraction<Context>): Promise<void> {\n if (this.autocompleteFn == undefined) {\n throw new Error(`Command \"${this.name}\" does not have an autocomplete handler`);\n }\n await this.autocompleteFn(interaction);\n }\n\n /**\n * Override option/subcommand adders so they return `this` (the handler),\n * preserving chaining when options/subcommands are added.\n */\n addBooleanOption(input: SlashCommandBooleanOption | ((builder: SlashCommandBooleanOption) => SlashCommandBooleanOption)): this {\n super.addBooleanOption(input);\n return this;\n }\n\n addUserOption(input: SlashCommandUserOption | ((builder: SlashCommandUserOption) => SlashCommandUserOption)): this {\n super.addUserOption(input);\n return this;\n }\n\n addChannelOption(input: SlashCommandChannelOption | ((builder: SlashCommandChannelOption) => SlashCommandChannelOption)): this {\n super.addChannelOption(input);\n return this;\n }\n\n addRoleOption(input: SlashCommandRoleOption | ((builder: SlashCommandRoleOption) => SlashCommandRoleOption)): this {\n super.addRoleOption(input);\n return this;\n }\n\n addAttachmentOption(\n input: SlashCommandAttachmentOption | ((builder: SlashCommandAttachmentOption) => SlashCommandAttachmentOption)\n ): this {\n super.addAttachmentOption(input);\n return this;\n }\n\n addMentionableOption(\n input: SlashCommandMentionableOption | ((builder: SlashCommandMentionableOption) => SlashCommandMentionableOption)\n ): this {\n super.addMentionableOption(input);\n return this;\n }\n\n addStringOption(input: SlashCommandStringOption | ((builder: SlashCommandStringOption) => SlashCommandStringOption)): this {\n super.addStringOption(input);\n return this;\n }\n\n addIntegerOption(input: SlashCommandIntegerOption | ((builder: SlashCommandIntegerOption) => SlashCommandIntegerOption)): this {\n super.addIntegerOption(input);\n return this;\n }\n\n addNumberOption(input: SlashCommandNumberOption | ((builder: SlashCommandNumberOption) => SlashCommandNumberOption)): this {\n super.addNumberOption(input);\n return this;\n }\n\n addSubcommand(\n input: SlashCommandSubcommandBuilder | ((sub: SlashCommandSubcommandBuilder) => SlashCommandSubcommandBuilder)\n ): this {\n super.addSubcommand(input);\n return this;\n }\n\n addSubcommandGroup(\n input:\n | SlashCommandSubcommandGroupBuilder\n | ((group: SlashCommandSubcommandGroupBuilder) => SlashCommandSubcommandGroupBuilder)\n ): this {\n super.addSubcommandGroup(input);\n return this;\n }\n}\n\nexport class ContextCommandHandler<\n T extends ContextCommandType = ContextCommandType,\n Context extends BaseInteractionContext = BaseInteractionContext,\n InteractionData = T extends ContextCommandType.User ? UserContextInteraction<Context> : MessageContextInteraction<Context>,\n> extends ContextMenuCommandBuilder {\n readonly handlerType = \"context\";\n private handlerFn?: (interaction: InteractionData) => Promise<any> | any;\n /**\n * Set of guild IDs where this command is registered (empty for global commands)\n */\n readonly guildIds = new Set<string>();\n\n isGuildCommand(): boolean {\n return this.guildIds.size > 0;\n }\n\n setGuildIds(guildIds: string[]): this {\n this.guildIds.clear();\n for (const guildId of guildIds) {\n this.guildIds.add(guildId);\n }\n return this;\n }\n\n addGuildIds(...guildIds: string[]): this {\n for (const guildId of guildIds) {\n this.guildIds.add(guildId);\n }\n return this;\n }\n\n removeGuildIds(...guildIds: string[]): this {\n for (const guildId of guildIds) {\n this.guildIds.delete(guildId);\n }\n return this;\n }\n\n public addHandler(\n handler: (interaction: InteractionData) => Promise<any> | any\n ): ContextCommandHandler<T, Context, InteractionData> {\n this.handlerFn = handler;\n return this;\n }\n\n /**\n * Executes the command handler\n */\n async execute(interaction: InteractionData): Promise<void> {\n if (!this.handlerFn) {\n throw new Error(`Command \"${this.name}\" does not have a handler`);\n }\n await this.handlerFn(interaction);\n }\n}\n\n/**\n * Handler for message components (buttons, select menus) based on custom ID prefix\n */\nexport class ComponentHandler<\n T extends MessageComponentType = MessageComponentType,\n Context extends BaseInteractionContext = BaseInteractionContext,\n> {\n readonly handlerType = \"component\";\n public readonly prefix: string;\n private handlerFn?: (interaction: MessageComponentInteraction<T, Context>) => Promise<any> | any;\n\n constructor(prefix: string, handler?: (interaction: MessageComponentInteraction<T, Context>) => Promise<any> | any) {\n if (!prefix || typeof prefix !== \"string\") {\n throw new TypeError(\"Component handler prefix must be a non-empty string\");\n }\n\n this.prefix = prefix;\n if (handler) this.handlerFn = handler;\n }\n\n addHandler(\n handler: (interaction: MessageComponentInteraction<T, Context>) => Promise<any> | any\n ): ComponentHandler<T, Context> {\n this.handlerFn = handler;\n return this;\n }\n\n /**\n * Executes the component handler\n */\n async execute(interaction: MessageComponentInteraction<T, Context>): Promise<void> {\n if (!this.handlerFn) {\n throw new Error(`Component handler with prefix \"${this.prefix}\" does not have a handler`);\n }\n await this.handlerFn(interaction);\n }\n\n /**\n * Checks if this handler matches the given custom ID\n */\n matches(customId: string): boolean {\n const prefix = parseCustomId(customId, true);\n return prefix === this.prefix;\n }\n}\n\n/**\n * Handler for modal submits based on custom ID prefix\n */\nexport class ModalHandler<Context extends BaseInteractionContext = BaseInteractionContext> {\n readonly handlerType = \"modal\";\n public readonly prefix: string;\n private handlerFn?: (interaction: ModalInteraction<Context>) => Promise<any> | any;\n\n constructor(prefix: string, handler?: (interaction: ModalInteraction<Context>) => Promise<any> | any) {\n if (!prefix || typeof prefix !== \"string\") {\n throw new TypeError(\"Modal handler prefix must be a non-empty string\");\n }\n\n this.prefix = prefix;\n if (handler) this.handlerFn = handler;\n }\n\n addHandler(handler: (interaction: ModalInteraction<Context>) => Promise<any> | any): ModalHandler<Context> {\n this.handlerFn = handler;\n return this;\n }\n\n /**\n * Executes the modal handler\n */\n async execute(interaction: ModalInteraction<Context>): Promise<void> {\n if (!this.handlerFn) {\n throw new Error(`Modal handler with prefix \"${this.prefix}\" does not have a handler`);\n }\n await this.handlerFn(interaction);\n }\n\n /**\n * Checks if this handler matches the given custom ID\n */\n matches(customId: string): boolean {\n const prefix = parseCustomId(customId, true);\n return prefix === this.prefix;\n }\n}\n\n/**\n * Union type of all possible handlers\n */\nexport type Handler<Context extends BaseInteractionContext = BaseInteractionContext> =\n | SlashCommandHandler<Context>\n | ContextCommandHandler<ContextCommandType, Context>\n | ComponentHandler<MessageComponentType, Context>\n | ModalHandler<Context>;\n\nexport type CommandHandler<Context extends BaseInteractionContext = BaseInteractionContext> =\n | SlashCommandHandler<Context>\n | ContextCommandHandler<ContextCommandType, Context>;\n","import {\n APIApplicationCommandAutocompleteInteraction,\n APIApplicationCommandInteraction,\n ApplicationCommandType,\n InteractionResponseType,\n InteractionType,\n} from \"discord-api-types/v10\";\nimport { ChatInputCommandInteraction } from \"@ctx/ChatInputInteraction\";\nimport { API } from \"@discordjs/core/http-only\";\nimport { REST } from \"@discordjs/rest\";\nimport { Hono } from \"hono\";\nimport { verifyDiscordRequest } from \"@utils/discordVerify\";\nimport { parseCustomId } from \"@utils/index\";\nimport type {\n BaseVariables,\n BaseInteractionContext,\n ValidInteraction,\n MessageComponentInteractionPayload,\n MessageComponentType,\n FlatOrNestedArray,\n} from \"./types\";\nimport { UserContextInteraction } from \"@ctx/UserContextCommandInteraction\";\nimport { MessageContextInteraction } from \"@ctx/MessageContextCommandInteraction\";\nimport { MessageComponentInteraction } from \"@ctx/MessageComponentInteraction\";\nimport { ModalInteraction } from \"@ctx/ModalInteraction\";\nimport { AutocompleteInteraction } from \"@ctx/AutocompleteInteraction\";\nimport { SlashCommandHandler, ContextCommandHandler, ComponentHandler, ModalHandler, type Handler } from \"@ctx/handlers\";\n\ninterface HonocordOptions {\n /**\n * Indicates whether the Honocord instance is running on Cloudflare Workers.\n *\n * This affects how interactions are processed, allowing for asynchronous handling using the Workers' execution context.\n *\n * @default c.env.IS_CF_WORKER === \"true\" # later determined from environment variable\n */\n isCFWorker?: boolean;\n /**\n * Whether to turn on debug logging for REST API requests.\n *\n * @default false\n */\n debugRest?: boolean;\n}\n\nexport class Honocord {\n private commandHandlers = new Map<string, SlashCommandHandler | ContextCommandHandler>();\n private componentHandlers = new Map<string, ComponentHandler>();\n private modalHandlers = new Map<string, ModalHandler>();\n private isCFWorker: boolean;\n private debugRest: boolean;\n\n constructor({ isCFWorker, debugRest }: HonocordOptions = {}) {\n this.isCFWorker = isCFWorker ?? false;\n this.debugRest = debugRest ?? false;\n }\n\n /**\n * Registers handlers for interactions.\n *\n * @param handlers - Array of CommandHandler, ComponentHandler, or ModalHandler instances\n *\n * For an example of usage, see the [Example Repository](https://github.com/The-LukeZ/honocord-examples).\n */\n loadHandlers(...handlers: FlatOrNestedArray<Handler>): void {\n const flattenedHandlers = handlers.flat(Infinity) as Handler[];\n\n for (const handler of flattenedHandlers) {\n if (handler instanceof SlashCommandHandler || handler instanceof ContextCommandHandler) {\n if (this.commandHandlers.has(handler.name)) {\n console.warn(`Command handler for \"${handler.name}\" already exists. Overwriting.`);\n }\n this.commandHandlers.set(handler.name, handler);\n } else if (handler instanceof ComponentHandler) {\n const prefix = handler.prefix;\n if (this.componentHandlers.has(prefix)) {\n console.warn(`Component handler with prefix \"${prefix}\" already exists. Overwriting.`);\n }\n this.componentHandlers.set(prefix, handler);\n } else if (handler instanceof ModalHandler) {\n const prefix = handler.prefix;\n if (this.modalHandlers.has(prefix)) {\n console.warn(`Modal handler with prefix \"${prefix}\" already exists. Overwriting.`);\n }\n this.modalHandlers.set(prefix, handler);\n }\n }\n }\n\n private createCommandInteraction(ctx: BaseInteractionContext, interaction: APIApplicationCommandInteraction, api: API) {\n switch (interaction.data.type) {\n case ApplicationCommandType.ChatInput:\n return new ChatInputCommandInteraction(api, interaction as any, ctx);\n case ApplicationCommandType.User:\n return new UserContextInteraction(api, interaction as any, ctx);\n case ApplicationCommandType.Message:\n return new MessageContextInteraction(api, interaction as any, ctx);\n default:\n throw new Error(\n `Unsupported application command type: ${interaction.data.type} (${ApplicationCommandType[interaction.data.type]})`\n );\n }\n }\n\n private async handleCommandInteraction(ctx: BaseInteractionContext, interaction: APIApplicationCommandInteraction, api: API) {\n const interactionObj = this.createCommandInteraction(ctx, interaction, api);\n const commandName = interaction.data.name;\n const handler = this.commandHandlers.get(commandName);\n\n if (handler) {\n try {\n if (handler instanceof SlashCommandHandler && interaction.data.type === ApplicationCommandType.ChatInput) {\n await handler.execute(interactionObj as ChatInputCommandInteraction);\n } else if (handler instanceof ContextCommandHandler) {\n if (interaction.data.type === ApplicationCommandType.User) {\n await handler.execute(interactionObj as UserContextInteraction);\n } else if (interaction.data.type === ApplicationCommandType.Message) {\n await handler.execute(interactionObj as MessageContextInteraction);\n }\n }\n } catch (error) {\n console.error(`Error executing command handler for \"${commandName}\":`, error);\n throw error;\n }\n }\n\n return interactionObj;\n }\n\n private async handleAutocompleteInteraction(\n ctx: BaseInteractionContext,\n interaction: APIApplicationCommandAutocompleteInteraction,\n api: API\n ) {\n const interactionObj = new AutocompleteInteraction(api, interaction, ctx);\n const commandName = interaction.data.name;\n const handler = this.commandHandlers.get(commandName);\n\n if (handler && handler instanceof SlashCommandHandler) {\n try {\n await handler.executeAutocomplete(interactionObj);\n } catch (error) {\n console.error(`Error executing autocomplete handler for \"${commandName}\":`, error);\n throw error;\n }\n }\n\n return interactionObj;\n }\n\n private async handleComponentInteraction<T extends MessageComponentType>(\n ctx: BaseInteractionContext,\n interaction: MessageComponentInteractionPayload<T>,\n api: API\n ) {\n const interactionObj = new MessageComponentInteraction<T>(api, interaction, ctx);\n const prefix = parseCustomId(interaction.data.custom_id, true);\n\n // Lookup handler by prefix\n const handler = this.componentHandlers.get(prefix);\n if (handler) {\n try {\n await handler.execute(interactionObj);\n } catch (error) {\n console.error(`Error executing component handler for prefix \"${prefix}\":`, error);\n throw error;\n }\n }\n\n return interactionObj;\n }\n\n private async handleModalInteraction(\n ctx: BaseInteractionContext,\n interaction: Extract<ValidInteraction, { type: InteractionType.ModalSubmit }>,\n api: API\n ) {\n const interactionObj = new ModalInteraction(api, interaction, ctx);\n const customId = interaction.data.custom_id;\n const prefix = parseCustomId(customId, true);\n\n // Lookup handler by prefix\n const handler = this.modalHandlers.get(prefix);\n\n if (handler) {\n try {\n await handler.execute(interactionObj);\n } catch (error) {\n console.error(`Error executing modal handler for prefix \"${prefix}\":`, error);\n throw error;\n }\n }\n\n return interactionObj;\n }\n\n private async createInteraction(ctx: BaseInteractionContext, interaction: ValidInteraction) {\n const rest = new REST({ authPrefix: \"Bot\" }).setToken(ctx.env.DISCORD_TOKEN as string);\n if (this.debugRest) {\n rest\n .addListener(\"response\", (request, response) => {\n console.debug(\n `[REST] ${request.method} ${request.path} -> ${response.status} ${response.statusText} (${request.route})`\n );\n })\n .addListener(\"restDebug\", (info) => {\n console.debug(`[REST DEBUG] ${info}`);\n });\n }\n const api = new API(rest);\n\n switch (interaction.type) {\n case InteractionType.ApplicationCommand:\n return await this.handleCommandInteraction(ctx, interaction, api);\n case InteractionType.MessageComponent:\n return await this.handleComponentInteraction(ctx, interaction, api);\n case InteractionType.ModalSubmit:\n return await this.handleModalInteraction(ctx, interaction, api);\n case InteractionType.ApplicationCommandAutocomplete:\n return await this.handleAutocompleteInteraction(ctx, interaction, api);\n default:\n throw new Error(`Unknown interaction type: ${(interaction as any).type} (${InteractionType[(interaction as any).type]})`);\n }\n }\n\n /**\n * Returns a Hono handler for POST Requests handling Discord interactions.\n *\n * @example\n * ```typescript\n * import { Hono } from \"hono\";\n * import { Honocord } from \"honocord\";\n *\n * const app = new Hono();\n * const bot = new Honocord();\n *\n * app.get(\"/\", (c) => c.text(\"🔥 Honocord is running!\"));\n * app.post(\"/interactions\", bot.handle);\n *\n * export default app;\n * ```\n */\n handle = async (c: BaseInteractionContext) => {\n // Check if running on CF Workers\n const isCFWorker = this.isCFWorker || c.env.IS_CF_WORKER === \"true\";\n\n // Verify the request\n const { isValid, interaction } = await verifyDiscordRequest(c.req, c.env.DISCORD_PUBLIC_KEY as string);\n if (!isValid) {\n return c.text(\"Bad request signature.\", 401);\n } else if (!interaction) {\n console.log(\"No interaction found in request\");\n return c.text(\"No interaction found.\", 400);\n }\n\n if (interaction.type === InteractionType.Ping) {\n console.log(\"Received Discord Ping\");\n return c.json({ type: InteractionResponseType.Pong });\n }\n\n // Handle CF Workers execution context\n if (isCFWorker && c.executionCtx?.waitUntil) {\n // Process interaction asynchronously\n c.executionCtx.waitUntil(\n new Promise(async (resolve) => {\n try {\n await this.createInteraction(c, interaction);\n } catch (error) {\n console.error(\"Error handling interaction:\", error);\n }\n resolve(undefined);\n })\n );\n return c.json({}, 202); // Accepted for processing\n }\n\n // Standard non-CF Workers execution\n try {\n await this.createInteraction(c, interaction);\n } catch (error) {\n console.error(\"Error handling interaction:\", error);\n return c.text(\"Internal server error.\", 500);\n }\n };\n\n /**\n * Returns a Hono App instance with the interaction handler mounted at the root path and a GET Handler for all paths, which returns a simple Health response.\n *\n * @example\n * ```typescript\n * import { Honocord } from \"honocord\";\n *\n * const honoCord = new Honocord();\n *\n * export default honoCord.getApp();\n * ```\n */\n getApp() {\n const app = new Hono<{ Variables: BaseVariables }>();\n app.get(\"*\", (c) => c.text(\"🔥 Honocord is running!\"));\n app.post(\"/\", this.handle);\n return app;\n }\n}\n"],"mappings":";;;;;;;;;;;;AAqCA,IAAM,mCAAN,MAAuC;;;;CAIrC,AAAQ,SAAwB;;;;CAIhC,AAAQ,cAA6B;;;;;CAKrC,AAAQ;CAIR,AAAQ;CAER,YAC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