honocord 0.0.14 → 1.0.0
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/README.md +30 -147
- package/dist/index.d.mts +120 -44
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +30 -33
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -230,141 +230,7 @@ bot.loadHandlers(feedbackHandler);
|
|
|
230
230
|
|
|
231
231
|
## Complete Example
|
|
232
232
|
|
|
233
|
-
|
|
234
|
-
<summary>If you want to only use Honocord for your project and have no existing Hono app:</summary>
|
|
235
|
-
|
|
236
|
-
```typescript
|
|
237
|
-
import { Honocord, SlashCommandHandler, ComponentHandler, ModalHandler, parseCustomId } from "honocord";
|
|
238
|
-
|
|
239
|
-
const bot = new Honocord();
|
|
240
|
-
|
|
241
|
-
// Slash command
|
|
242
|
-
const greetCommand = new SlashCommandHandler()
|
|
243
|
-
.setName("greet")
|
|
244
|
-
.setDescription("Sends a greeting")
|
|
245
|
-
.addStringOption((option) => option.setName("name").setDescription("Who to greet").setRequired(true));
|
|
246
|
-
|
|
247
|
-
greetCommand.addHandler(async (interaction) => {
|
|
248
|
-
const name = interaction.options.getString("name", true);
|
|
249
|
-
await interaction.reply(`Hello, ${name}! 👋`);
|
|
250
|
-
});
|
|
251
|
-
|
|
252
|
-
// Component handler for buttons
|
|
253
|
-
const confirmHandler = new ComponentHandler("confirm", async (interaction) => {
|
|
254
|
-
const { params } = parseCustomId(interaction.custom_id);
|
|
255
|
-
const action = params[0];
|
|
256
|
-
|
|
257
|
-
await interaction.update({
|
|
258
|
-
content: `You confirmed: ${action}`,
|
|
259
|
-
components: [], // Remove buttons
|
|
260
|
-
});
|
|
261
|
-
});
|
|
262
|
-
|
|
263
|
-
// Modal handler
|
|
264
|
-
const reportHandler = new ModalHandler("report", async (interaction) => {
|
|
265
|
-
const reason = interaction.fields.getString("reason");
|
|
266
|
-
const details = interaction.fields.getString("details");
|
|
267
|
-
|
|
268
|
-
await interaction.reply(
|
|
269
|
-
{
|
|
270
|
-
content: "Report submitted successfully!",
|
|
271
|
-
},
|
|
272
|
-
true
|
|
273
|
-
);
|
|
274
|
-
|
|
275
|
-
// Process the report...
|
|
276
|
-
console.log(`Report received: Reason - ${reason}, Details - ${details}`);
|
|
277
|
-
});
|
|
278
|
-
|
|
279
|
-
// Register all handlers
|
|
280
|
-
bot.loadHandlers(greetCommand, confirmHandler, reportHandler);
|
|
281
|
-
|
|
282
|
-
// For Cloudflare Workers
|
|
283
|
-
export default bot.getApp();
|
|
284
|
-
```
|
|
285
|
-
|
|
286
|
-
</details>
|
|
287
|
-
|
|
288
|
-
or
|
|
289
|
-
|
|
290
|
-
<details>
|
|
291
|
-
<summary>You want to use Honocord with your existing Hono app:</summary>
|
|
292
|
-
|
|
293
|
-
```typescript
|
|
294
|
-
/**
|
|
295
|
-
* Example: Using HonoCord with custom environment types in a Hono app
|
|
296
|
-
*/
|
|
297
|
-
|
|
298
|
-
import { Hono } from "hono";
|
|
299
|
-
import { Honocord, SlashCommandHandler, ComponentHandler } from "honocord";
|
|
300
|
-
import type { BaseHonocordEnv, BaseInteractionContext } from "honocord";
|
|
301
|
-
|
|
302
|
-
// Define your custom bindings
|
|
303
|
-
interface MyBindings {
|
|
304
|
-
DISCORD_TOKEN: string;
|
|
305
|
-
DATABASE: D1Database;
|
|
306
|
-
CACHE: KVNamespace;
|
|
307
|
-
IS_CF_WORKER: "true";
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
// Create custom environment and context types
|
|
311
|
-
type MyEnv = BaseHonocordEnv<MyBindings>;
|
|
312
|
-
type MyContext = BaseInteractionContext<MyBindings>;
|
|
313
|
-
|
|
314
|
-
// Create Hono app
|
|
315
|
-
const app = new Hono<MyEnv>();
|
|
316
|
-
|
|
317
|
-
// Initialize bot
|
|
318
|
-
const bot = new Honocord();
|
|
319
|
-
|
|
320
|
-
// Create command with type-safe environment access
|
|
321
|
-
const pingCommand = new SlashCommandHandler().setName("ping").setDescription("Ping the bot");
|
|
322
|
-
|
|
323
|
-
pingCommand.addHandler(async (interaction) => {
|
|
324
|
-
const ctx = interaction.ctx as MyContext;
|
|
325
|
-
|
|
326
|
-
// Type-safe access to bindings
|
|
327
|
-
const cache = ctx.env.CACHE;
|
|
328
|
-
await cache.put("last_ping", new Date().toISOString());
|
|
329
|
-
|
|
330
|
-
await interaction.reply("Pong! 🏓");
|
|
331
|
-
});
|
|
332
|
-
|
|
333
|
-
// Create command that queries database
|
|
334
|
-
const statsCommand = new SlashCommandHandler().setName("stats").setDescription("Show bot stats");
|
|
335
|
-
|
|
336
|
-
statsCommand.addHandler(async (interaction) => {
|
|
337
|
-
const ctx = interaction.ctx as MyContext;
|
|
338
|
-
const db = ctx.env.DATABASE;
|
|
339
|
-
|
|
340
|
-
const result = await db.prepare("SELECT COUNT(*) as count FROM users").first();
|
|
341
|
-
await interaction.reply(`Total users: ${result?.count ?? 0}`);
|
|
342
|
-
});
|
|
343
|
-
|
|
344
|
-
// Component handler
|
|
345
|
-
const approveButton = new ComponentHandler("approve", async (interaction) => {
|
|
346
|
-
const ctx = interaction.ctx as MyContext;
|
|
347
|
-
const db = ctx.env.DATABASE;
|
|
348
|
-
|
|
349
|
-
// Update database
|
|
350
|
-
await db.prepare("UPDATE requests SET approved = 1").run();
|
|
351
|
-
|
|
352
|
-
await interaction.update({ content: "✅ Approved!" });
|
|
353
|
-
});
|
|
354
|
-
|
|
355
|
-
// Load handlers
|
|
356
|
-
bot.loadHandlers(pingCommand, statsCommand, approveButton);
|
|
357
|
-
|
|
358
|
-
// Interaction endpoint
|
|
359
|
-
app.post("/interactions", (c) => bot.handle(c as MyContext));
|
|
360
|
-
|
|
361
|
-
// Regular API routes
|
|
362
|
-
app.get("/", (c) => c.json({ status: "ok" }));
|
|
363
|
-
|
|
364
|
-
export default app;
|
|
365
|
-
```
|
|
366
|
-
|
|
367
|
-
</details>
|
|
233
|
+
Please refer to the [Examples](/The-LukeZ/honocord-examples) repository for complete working examples, including deployment to Cloudflare Workers.
|
|
368
234
|
|
|
369
235
|
## Environment Variables
|
|
370
236
|
|
|
@@ -384,24 +250,26 @@ HonoCord is written in TypeScript and provides full type safety.
|
|
|
384
250
|
### Custom Environment Types
|
|
385
251
|
|
|
386
252
|
```typescript
|
|
253
|
+
// src/types.ts
|
|
387
254
|
import type { BaseHonocordEnv, BaseInteractionContext } from "honocord";
|
|
388
255
|
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
DISCORD_PUBLIC_KEY: string;
|
|
393
|
-
DATABASE_URL: string;
|
|
394
|
-
}
|
|
256
|
+
type MyEnv = {
|
|
257
|
+
MY_VARIABLE: string;
|
|
258
|
+
};
|
|
395
259
|
|
|
396
|
-
|
|
397
|
-
type MyContext = BaseInteractionContext<MyEnv>;
|
|
260
|
+
export type HonoEnv = BaseHonocordEnv<MyEnv>;
|
|
261
|
+
export type MyContext = BaseInteractionContext<MyEnv>;
|
|
262
|
+
|
|
263
|
+
// src/index.ts
|
|
264
|
+
import type { BaseHonocordEnv, BaseInteractionContext } from "honocord";
|
|
265
|
+
import type { HonoEnv, MyContext } from "./types";
|
|
398
266
|
|
|
399
267
|
// Use in your handlers
|
|
400
268
|
const command = new SlashCommandHandler()
|
|
401
269
|
.setName("data")
|
|
402
270
|
.setDescription("Fetch data")
|
|
403
271
|
.addHandler(async (interaction: MyContext) => {
|
|
404
|
-
const
|
|
272
|
+
const myVariable = interaction.env.MY_VARIABLE; // Fully typed!
|
|
405
273
|
// ...
|
|
406
274
|
});
|
|
407
275
|
```
|
|
@@ -449,6 +317,8 @@ Main class for handling Discord interactions.
|
|
|
449
317
|
- `loadHandlers(handlers: Handler[])` - Registers interaction handlers
|
|
450
318
|
- `handle(c: Context)` - Hono handler for processing interactions
|
|
451
319
|
- `getApp()` - Returns a pre-configured Hono app instance
|
|
320
|
+
- Route: `POST /interactions` - Handles Discord interaction requests
|
|
321
|
+
- Route: `GET *` - Displays a generic "Is Running" text.
|
|
452
322
|
|
|
453
323
|
### `SlashCommandHandler`
|
|
454
324
|
|
|
@@ -463,9 +333,20 @@ Extends `SlashCommandBuilder` from `@discordjs/builders`.
|
|
|
463
333
|
|
|
464
334
|
Extends `ContextMenuCommandBuilder` from `@discordjs/builders`.
|
|
465
335
|
|
|
336
|
+
**Constructor:**
|
|
337
|
+
|
|
338
|
+
```ts
|
|
339
|
+
new ContextCommandHandler<
|
|
340
|
+
T extends ContextCommandType = ContextCommandType,
|
|
341
|
+
InteractionData = T extends ContextCommandType.User ? UserCommandInteraction : MessageCommandInteraction,
|
|
342
|
+
> ()
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
`ContextCommandType` is an enum with values `User` and `Message`; Derived from ApplicationCommandType, but narrowed down to the two context command types.
|
|
346
|
+
|
|
466
347
|
**Methods:**
|
|
467
348
|
|
|
468
|
-
- `addHandler(handler: (interaction:
|
|
349
|
+
- `addHandler(handler: (interaction: InteractionData) => Promise<void> | void)` - Adds the command execution handler
|
|
469
350
|
|
|
470
351
|
### `ComponentHandler`
|
|
471
352
|
|
|
@@ -473,11 +354,13 @@ Handler for message components.
|
|
|
473
354
|
|
|
474
355
|
**Constructor:**
|
|
475
356
|
|
|
476
|
-
- `new ComponentHandler(prefix: string, handler?: Function)` - Creates a handler for components with the given prefix
|
|
357
|
+
- `new ComponentHandler<T extends MessageComponentType = MessageComponentType>(prefix: string, handler?: Function)` - Creates a handler for components with the given prefix
|
|
358
|
+
|
|
359
|
+
`MessageComponentType` is a union of `ComponentType` values that represent message components (e.g., Button, StringSelectMenu).
|
|
477
360
|
|
|
478
361
|
**Methods:**
|
|
479
362
|
|
|
480
|
-
- `addHandler(handler: (interaction: MessageComponentInteraction) => Promise<void> | void)` - Adds or replaces the component handler function
|
|
363
|
+
- `addHandler(handler: (interaction: MessageComponentInteraction<T>) => Promise<void> | void)` - Adds or replaces the component handler function
|
|
481
364
|
|
|
482
365
|
### `ModalHandler`
|
|
483
366
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as discord_api_types_v1027 from "discord-api-types/v10";
|
|
2
|
-
import { APIApplicationCommandAutocompleteInteraction, APIApplicationCommandInteractionDataOption, APIApplicationCommandOptionChoice, APIAttachment, APIChatInputApplicationCommandInteraction, APIChatInputApplicationCommandInteraction as APIChatInputApplicationCommandInteraction$1, APIInteraction, APIInteraction as APIInteraction$1, APIInteractionDataResolved, APIInteractionDataResolvedChannel, APIInteractionDataResolvedGuildMember, APIInteractionResponseCallbackData, APIMessage, APIMessageApplicationCommandInteraction, APIMessageButtonInteractionData, APIMessageChannelSelectInteractionData, APIMessageComponentInteraction, APIMessageComponentInteraction as APIMessageComponentInteraction$1, APIMessageMentionableSelectInteractionData, APIMessageRoleSelectInteractionData, APIMessageStringSelectInteractionData, APIMessageUserSelectInteractionData, APIModalInteractionResponseCallbackData, APIModalSubmitInteraction, APIModalSubmitInteraction as APIModalSubmitInteraction$1, APIPartialInteractionGuild, APIPingInteraction, APIRole, APIUser, APIUserApplicationCommandInteraction, ApplicationCommandOptionType, ApplicationCommandType, ChannelType, ComponentType, InteractionResponseType, InteractionType, Locale, ModalSubmitLabelComponent, ModalSubmitTextDisplayComponent, Snowflake } from "discord-api-types/v10";
|
|
2
|
+
import { APIApplicationCommandAutocompleteInteraction, APIApplicationCommandInteractionData, APIApplicationCommandInteractionDataOption, APIApplicationCommandOptionChoice, APIAttachment, APIChatInputApplicationCommandInteraction, APIChatInputApplicationCommandInteraction as APIChatInputApplicationCommandInteraction$1, APIInteraction, APIInteraction as APIInteraction$1, APIInteractionDataResolved, APIInteractionDataResolvedChannel, APIInteractionDataResolvedGuildMember, APIInteractionResponseCallbackData, APIMessage, APIMessageApplicationCommandInteraction, APIMessageButtonInteractionData, APIMessageChannelSelectInteractionData, APIMessageComponentInteraction, APIMessageComponentInteraction as APIMessageComponentInteraction$1, APIMessageMentionableSelectInteractionData, APIMessageRoleSelectInteractionData, APIMessageStringSelectInteractionData, APIMessageUserSelectInteractionData, APIModalInteractionResponseCallbackData, APIModalSubmitInteraction, APIModalSubmitInteraction as APIModalSubmitInteraction$1, APIPartialInteractionGuild, APIPingInteraction, APIRole, APIUser, APIUserApplicationCommandInteraction, ApplicationCommandOptionType, ApplicationCommandType, 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, SlashCommandSubcommandGroupBuilder, SlashCommandUserOption, StringSelectMenuBuilder, StringSelectMenuOptionBuilder, TextDisplayBuilder, TextInputBuilder, ThumbnailBuilder, UserSelectMenuBuilder } from "@discordjs/builders";
|
|
5
5
|
import { API, API as API$1 } from "@discordjs/core/http-only";
|
|
@@ -8,7 +8,8 @@ import * as hono0 from "hono";
|
|
|
8
8
|
import { Context, Hono } from "hono";
|
|
9
9
|
import * as hono_utils_http_status0 from "hono/utils/http-status";
|
|
10
10
|
import * as hono_types0 from "hono/types";
|
|
11
|
-
import { BlankInput } from "hono/types";
|
|
11
|
+
import { Bindings, BlankInput, Variables } from "hono/types";
|
|
12
|
+
import { Snowflake as Snowflake$2 } from "discord-api-types/globals";
|
|
12
13
|
|
|
13
14
|
//#region src/resolvers/CommandOptionResolver.d.ts
|
|
14
15
|
type AutocompleteFocusedOption = {
|
|
@@ -47,8 +48,8 @@ declare class CommandInteractionOptionResolver {
|
|
|
47
48
|
*/
|
|
48
49
|
private _hoistedOptions;
|
|
49
50
|
private _resolved;
|
|
50
|
-
constructor(options: APIApplicationCommandInteractionDataOption<InteractionType.ApplicationCommand | InteractionType.ApplicationCommandAutocomplete>[] | undefined, resolved: APIInteractionDataResolved | undefined);
|
|
51
|
-
get data(): APIApplicationCommandInteractionDataOption<InteractionType.ApplicationCommand | InteractionType.ApplicationCommandAutocomplete>[];
|
|
51
|
+
constructor(options: APIApplicationCommandInteractionDataOption<InteractionType$1.ApplicationCommand | InteractionType$1.ApplicationCommandAutocomplete>[] | undefined, resolved: APIInteractionDataResolved | undefined);
|
|
52
|
+
get data(): APIApplicationCommandInteractionDataOption<InteractionType$1.ApplicationCommand | InteractionType$1.ApplicationCommandAutocomplete>[];
|
|
52
53
|
/**
|
|
53
54
|
* Gets an option by its name.
|
|
54
55
|
*
|
|
@@ -71,13 +72,13 @@ declare class CommandInteractionOptionResolver {
|
|
|
71
72
|
type: T;
|
|
72
73
|
}> | Extract<discord_api_types_v1027.APIApplicationCommandInteractionDataUserOption, {
|
|
73
74
|
type: T;
|
|
74
|
-
}> | Extract<discord_api_types_v1027.APIApplicationCommandInteractionDataIntegerOption<InteractionType.ApplicationCommand>, {
|
|
75
|
+
}> | Extract<discord_api_types_v1027.APIApplicationCommandInteractionDataIntegerOption<InteractionType$1.ApplicationCommand>, {
|
|
75
76
|
type: T;
|
|
76
|
-
}> | Extract<discord_api_types_v1027.APIApplicationCommandInteractionDataNumberOption<InteractionType.ApplicationCommand>, {
|
|
77
|
+
}> | Extract<discord_api_types_v1027.APIApplicationCommandInteractionDataNumberOption<InteractionType$1.ApplicationCommand>, {
|
|
77
78
|
type: T;
|
|
78
|
-
}> | Extract<discord_api_types_v1027.APIApplicationCommandInteractionDataSubcommandGroupOption<InteractionType.ApplicationCommand>, {
|
|
79
|
+
}> | Extract<discord_api_types_v1027.APIApplicationCommandInteractionDataSubcommandGroupOption<InteractionType$1.ApplicationCommand>, {
|
|
79
80
|
type: T;
|
|
80
|
-
}> | Extract<discord_api_types_v1027.APIApplicationCommandInteractionDataSubcommandOption<InteractionType.ApplicationCommand>, {
|
|
81
|
+
}> | Extract<discord_api_types_v1027.APIApplicationCommandInteractionDataSubcommandOption<InteractionType$1.ApplicationCommand>, {
|
|
81
82
|
type: T;
|
|
82
83
|
}> | null;
|
|
83
84
|
/**
|
|
@@ -114,8 +115,8 @@ declare class CommandInteractionOptionResolver {
|
|
|
114
115
|
* @param channelTypes The allowed types of channels. If empty, all channel types are allowed.
|
|
115
116
|
* @returns The value of the option, or null if not set and not required.
|
|
116
117
|
*/
|
|
117
|
-
getChannel(name: string, required: false, channelTypes: ChannelType[]): APIInteractionDataResolvedChannel | null;
|
|
118
|
-
getChannel(name: string, required: true, channelTypes: ChannelType[]): APIInteractionDataResolvedChannel;
|
|
118
|
+
getChannel(name: string, required: false, channelTypes: ChannelType$1[]): APIInteractionDataResolvedChannel | null;
|
|
119
|
+
getChannel(name: string, required: true, channelTypes: ChannelType$1[]): APIInteractionDataResolvedChannel;
|
|
119
120
|
/**
|
|
120
121
|
* Gets a string option.
|
|
121
122
|
*
|
|
@@ -190,20 +191,20 @@ declare class CommandInteractionOptionResolver {
|
|
|
190
191
|
}
|
|
191
192
|
//#endregion
|
|
192
193
|
//#region src/resolvers/ModalComponentResolver.d.ts
|
|
193
|
-
interface BaseModalData<Type extends ComponentType> {
|
|
194
|
+
interface BaseModalData<Type extends ComponentType$1> {
|
|
194
195
|
id?: number;
|
|
195
196
|
type: Type;
|
|
196
197
|
}
|
|
197
|
-
interface TextInputModalData extends BaseModalData<ComponentType.TextInput> {
|
|
198
|
+
interface TextInputModalData extends BaseModalData<ComponentType$1.TextInput> {
|
|
198
199
|
custom_id: string;
|
|
199
200
|
value: string;
|
|
200
201
|
}
|
|
201
|
-
interface SelectMenuModalData extends BaseModalData<ComponentType.ChannelSelect | ComponentType.MentionableSelect | ComponentType.RoleSelect | ComponentType.StringSelect | ComponentType.UserSelect> {
|
|
202
|
-
channels?: ReadonlyCollection$1<Snowflake, APIInteractionDataResolvedChannel>;
|
|
202
|
+
interface SelectMenuModalData extends BaseModalData<ComponentType$1.ChannelSelect | ComponentType$1.MentionableSelect | ComponentType$1.RoleSelect | ComponentType$1.StringSelect | ComponentType$1.UserSelect> {
|
|
203
|
+
channels?: ReadonlyCollection$1<Snowflake$1, APIInteractionDataResolvedChannel>;
|
|
203
204
|
custom_id: string;
|
|
204
|
-
members?: ReadonlyCollection$1<Snowflake, APIInteractionDataResolvedGuildMember>;
|
|
205
|
-
roles?: ReadonlyCollection$1<Snowflake, APIRole>;
|
|
206
|
-
users?: ReadonlyCollection$1<Snowflake, APIUser>;
|
|
205
|
+
members?: ReadonlyCollection$1<Snowflake$1, APIInteractionDataResolvedGuildMember>;
|
|
206
|
+
roles?: ReadonlyCollection$1<Snowflake$1, APIRole>;
|
|
207
|
+
users?: ReadonlyCollection$1<Snowflake$1, APIUser>;
|
|
207
208
|
/**
|
|
208
209
|
* The raw values selected by the user.
|
|
209
210
|
*/
|
|
@@ -283,7 +284,7 @@ declare class ModalComponentResolver {
|
|
|
283
284
|
}
|
|
284
285
|
//#endregion
|
|
285
286
|
//#region src/interactions/ModalInteraction.d.ts
|
|
286
|
-
declare class ModalInteraction extends BaseInteraction<InteractionType.ModalSubmit> {
|
|
287
|
+
declare class ModalInteraction extends BaseInteraction<InteractionType$1.ModalSubmit> {
|
|
287
288
|
readonly fields: ModalComponentResolver;
|
|
288
289
|
readonly message?: APIMessage;
|
|
289
290
|
readonly custom_id: string;
|
|
@@ -291,7 +292,7 @@ declare class ModalInteraction extends BaseInteraction<InteractionType.ModalSubm
|
|
|
291
292
|
}
|
|
292
293
|
//#endregion
|
|
293
294
|
//#region src/interactions/BaseInteraction.d.ts
|
|
294
|
-
declare abstract class BaseInteraction<Type extends InteractionType> {
|
|
295
|
+
declare abstract class BaseInteraction<Type extends InteractionType$1> {
|
|
295
296
|
protected api: API$1;
|
|
296
297
|
readonly type: Type;
|
|
297
298
|
protected readonly data: Extract<APIInteraction$1, {
|
|
@@ -306,7 +307,7 @@ declare abstract class BaseInteraction<Type extends InteractionType> {
|
|
|
306
307
|
get applicationId(): string;
|
|
307
308
|
get entitlements(): discord_api_types_v1027.APIEntitlement[];
|
|
308
309
|
get channelId(): string | undefined;
|
|
309
|
-
get channel(): (Partial<discord_api_types_v1027.APIAnnouncementThreadChannel> & Pick<discord_api_types_v1027.APIChannel, "
|
|
310
|
+
get channel(): (Partial<discord_api_types_v1027.APIAnnouncementThreadChannel> & Pick<discord_api_types_v1027.APIChannel, "id" | "type">) | (Partial<discord_api_types_v1027.APIDMChannel> & Pick<discord_api_types_v1027.APIChannel, "id" | "type">) | (Partial<discord_api_types_v1027.APIGroupDMChannel> & Pick<discord_api_types_v1027.APIChannel, "id" | "type">) | (Partial<discord_api_types_v1027.APIGuildCategoryChannel> & Pick<discord_api_types_v1027.APIChannel, "id" | "type">) | (Partial<discord_api_types_v1027.APIGuildForumChannel> & Pick<discord_api_types_v1027.APIChannel, "id" | "type">) | (Partial<discord_api_types_v1027.APIGuildMediaChannel> & Pick<discord_api_types_v1027.APIChannel, "id" | "type">) | (Partial<discord_api_types_v1027.APIGuildStageVoiceChannel> & Pick<discord_api_types_v1027.APIChannel, "id" | "type">) | (Partial<discord_api_types_v1027.APIGuildVoiceChannel> & Pick<discord_api_types_v1027.APIChannel, "id" | "type">) | (Partial<discord_api_types_v1027.APINewsChannel> & Pick<discord_api_types_v1027.APIChannel, "id" | "type">) | (Partial<discord_api_types_v1027.APIPrivateThreadChannel> & Pick<discord_api_types_v1027.APIChannel, "id" | "type">) | (Partial<discord_api_types_v1027.APIPublicThreadChannel> & Pick<discord_api_types_v1027.APIChannel, "id" | "type">) | (Partial<discord_api_types_v1027.APITextChannel> & Pick<discord_api_types_v1027.APIChannel, "id" | "type">) | undefined;
|
|
310
311
|
get guildId(): string | undefined;
|
|
311
312
|
get guild(): APIPartialInteractionGuild | undefined;
|
|
312
313
|
get userId(): string | undefined;
|
|
@@ -319,7 +320,7 @@ declare abstract class BaseInteraction<Type extends InteractionType> {
|
|
|
319
320
|
get appPermissions(): string;
|
|
320
321
|
get version(): 1;
|
|
321
322
|
inGuild(): this is BaseInteraction<Type> & {
|
|
322
|
-
guild_id: Snowflake;
|
|
323
|
+
guild_id: Snowflake$1;
|
|
323
324
|
guild: APIPartialInteractionGuild;
|
|
324
325
|
guild_locale: Locale;
|
|
325
326
|
};
|
|
@@ -334,8 +335,8 @@ declare abstract class BaseInteraction<Type extends InteractionType> {
|
|
|
334
335
|
reply(options: APIInteractionResponseCallbackData | string, forceEphemeral?: boolean): Promise<undefined>;
|
|
335
336
|
deferReply(forceEphemeral?: boolean): Promise<undefined>;
|
|
336
337
|
deferUpdate(): Promise<undefined>;
|
|
337
|
-
editReply(options: APIInteractionResponseCallbackData | string, messageId?: Snowflake | "@original"): Promise<discord_api_types_v1027.APIMessage>;
|
|
338
|
-
deleteReply(messageId?: Snowflake | "@original"): Promise<void>;
|
|
338
|
+
editReply(options: APIInteractionResponseCallbackData | string, messageId?: Snowflake$1 | "@original"): Promise<discord_api_types_v1027.APIMessage>;
|
|
339
|
+
deleteReply(messageId?: Snowflake$1 | "@original"): Promise<void>;
|
|
339
340
|
update(options: APIInteractionResponseCallbackData | string): Promise<undefined>;
|
|
340
341
|
isChatInputCommand(): this is ChatInputCommandInteraction;
|
|
341
342
|
isMessageContext(): this is APIMessageApplicationCommandInteraction;
|
|
@@ -343,18 +344,18 @@ declare abstract class BaseInteraction<Type extends InteractionType> {
|
|
|
343
344
|
isMessageComponent(): this is APIMessageComponentInteraction$1;
|
|
344
345
|
isButton(): this is APIMessageComponentInteraction$1 & {
|
|
345
346
|
data: {
|
|
346
|
-
component_type: ComponentType.Button;
|
|
347
|
+
component_type: ComponentType$1.Button;
|
|
347
348
|
};
|
|
348
349
|
};
|
|
349
350
|
isStringSelect(): this is APIMessageComponentInteraction$1 & {
|
|
350
351
|
data: {
|
|
351
|
-
component_type: Exclude<ComponentType, ComponentType.StringSelect>;
|
|
352
|
+
component_type: Exclude<ComponentType$1, ComponentType$1.StringSelect>;
|
|
352
353
|
};
|
|
353
354
|
};
|
|
354
355
|
}
|
|
355
356
|
//#endregion
|
|
356
357
|
//#region src/interactions/ChatInputInteraction.d.ts
|
|
357
|
-
declare class ChatInputCommandInteraction extends BaseInteraction<InteractionType.ApplicationCommand> {
|
|
358
|
+
declare class ChatInputCommandInteraction extends BaseInteraction<InteractionType$1.ApplicationCommand> {
|
|
358
359
|
readonly options: CommandInteractionOptionResolver;
|
|
359
360
|
constructor(api: API$1, interaction: APIChatInputApplicationCommandInteraction$1, c: BaseInteractionContext);
|
|
360
361
|
get commandName(): string;
|
|
@@ -363,7 +364,7 @@ declare class ChatInputCommandInteraction extends BaseInteraction<InteractionTyp
|
|
|
363
364
|
}
|
|
364
365
|
//#endregion
|
|
365
366
|
//#region src/interactions/MessageComponentInteraction.d.ts
|
|
366
|
-
declare class MessageComponentInteraction<T extends MessageComponentType = MessageComponentType> extends BaseInteraction<InteractionType.MessageComponent> {
|
|
367
|
+
declare class MessageComponentInteraction<T extends MessageComponentType = MessageComponentType> extends BaseInteraction<InteractionType$1.MessageComponent> {
|
|
367
368
|
readonly message?: APIMessage;
|
|
368
369
|
readonly custom_id: string;
|
|
369
370
|
constructor(api: API$1, interaction: MessageComponentInteractionPayload<T>, c: BaseInteractionContext);
|
|
@@ -391,15 +392,15 @@ interface BaseVariables {
|
|
|
391
392
|
/**
|
|
392
393
|
* Base context environment
|
|
393
394
|
*/
|
|
394
|
-
interface BaseHonocordEnv<TBindings extends
|
|
395
|
+
interface BaseHonocordEnv<TBindings extends Bindings = {}, TVariables extends Variables = {}> {
|
|
395
396
|
/**
|
|
396
397
|
* Bindings available in the environment (from the worker)
|
|
397
398
|
*/
|
|
398
|
-
Bindings: TBindings;
|
|
399
|
+
Bindings: TBindings & BaseBindings;
|
|
399
400
|
/**
|
|
400
|
-
* Variables available in the context (from Hono)
|
|
401
|
+
* Variables available in the context (from Hono + Honocord)
|
|
401
402
|
*/
|
|
402
|
-
Variables: TVariables;
|
|
403
|
+
Variables: TVariables & BaseVariables;
|
|
403
404
|
}
|
|
404
405
|
/**
|
|
405
406
|
* Generic context type that users can extend for type-safe access to environment bindings and variables.
|
|
@@ -444,24 +445,99 @@ interface BaseHonocordEnv<TBindings extends BaseBindings = BaseBindings, TVariab
|
|
|
444
445
|
* ```
|
|
445
446
|
*/
|
|
446
447
|
type BaseInteractionContext<TBindings extends BaseBindings = BaseBindings, TVariables extends BaseVariables = BaseVariables, TPath extends string = "/"> = Context<BaseHonocordEnv<TBindings, TVariables>, TPath, BlankInput>;
|
|
448
|
+
/**
|
|
449
|
+
* Collections of resolved data from Discord API interactions.
|
|
450
|
+
*
|
|
451
|
+
* When users or roles are mentioned in command options, Discord resolves them and provides
|
|
452
|
+
* the full data in these collections for easy access.
|
|
453
|
+
*/
|
|
454
|
+
interface APIInteractionDataResolvedCollections {
|
|
455
|
+
/** Map of user IDs to user objects */
|
|
456
|
+
users?: Collection$1<Snowflake$2, APIUser>;
|
|
457
|
+
/** Map of role IDs to role objects */
|
|
458
|
+
roles?: Collection$1<Snowflake$2, APIRole>;
|
|
459
|
+
/** Map of user IDs to guild member objects */
|
|
460
|
+
members?: Collection$1<Snowflake$2, APIInteractionDataResolvedGuildMember>;
|
|
461
|
+
/** Map of channel IDs to channel objects */
|
|
462
|
+
channels?: Collection$1<Snowflake$2, APIInteractionDataResolvedChannel>;
|
|
463
|
+
/** Map of attachment IDs to attachment objects */
|
|
464
|
+
attachments?: Collection$1<Snowflake$2, APIAttachment>;
|
|
465
|
+
}
|
|
447
466
|
/** Represents an interaction which the lib user can handle themselves (ping is handled internally) */
|
|
448
467
|
type ValidInteraction = Exclude<APIInteraction$1, APIPingInteraction>;
|
|
449
|
-
|
|
468
|
+
/**
|
|
469
|
+
* Generic handler function type for Discord interactions.
|
|
470
|
+
*
|
|
471
|
+
* @template T - The specific interaction type from Discord's InteractionType enum
|
|
472
|
+
*/
|
|
473
|
+
type InteractionHandler<T extends InteractionType$1> = (interaction: Extract<ValidInteraction, {
|
|
474
|
+
type: T;
|
|
475
|
+
}>) => void | Promise<void>;
|
|
476
|
+
/**
|
|
477
|
+
* Handler function type for application command interactions (slash commands, user commands, message commands).
|
|
478
|
+
*
|
|
479
|
+
* @template Data - The command data type (optional, defaults to generic command interaction data)
|
|
480
|
+
*/
|
|
481
|
+
type CommandInteractionHandler<Data = APIApplicationCommandInteractionData> = (interaction: Extract<Exclude<ValidInteraction, APIApplicationCommandAutocompleteInteraction>, {
|
|
482
|
+
type: InteractionType$1.ApplicationCommand;
|
|
483
|
+
data: Data;
|
|
484
|
+
}>) => void | Promise<void>;
|
|
485
|
+
/**
|
|
486
|
+
* Handler function type for autocomplete interactions.
|
|
487
|
+
*
|
|
488
|
+
* Called when a user is typing in a command option that has autocomplete enabled.
|
|
489
|
+
*/
|
|
490
|
+
type AutocompleteInteractionHandler = InteractionHandler<InteractionType$1.ApplicationCommandAutocomplete>;
|
|
491
|
+
/**
|
|
492
|
+
* Handler function type for modal submit interactions.
|
|
493
|
+
*
|
|
494
|
+
* Called when a user submits a modal (form).
|
|
495
|
+
*/
|
|
496
|
+
type ModalSubmitInteractionHandler = InteractionHandler<InteractionType$1.ModalSubmit>;
|
|
497
|
+
/**
|
|
498
|
+
* Handler function type for message component interactions.
|
|
499
|
+
*
|
|
500
|
+
* Called when a user interacts with a button, select menu, or other message component.
|
|
501
|
+
*/
|
|
502
|
+
type MessageComponentInteractionHandler = InteractionHandler<InteractionType$1.MessageComponent>;
|
|
503
|
+
/**
|
|
504
|
+
* Map of interaction types to their corresponding handler function types.
|
|
505
|
+
*
|
|
506
|
+
* Useful for creating type-safe handler registries or middleware systems.
|
|
507
|
+
*/
|
|
508
|
+
type InteractionHandlers = {
|
|
509
|
+
[InteractionType$1.ApplicationCommand]: CommandInteractionHandler<InteractionType$1.ApplicationCommand>;
|
|
510
|
+
[InteractionType$1.ApplicationCommandAutocomplete]: AutocompleteInteractionHandler;
|
|
511
|
+
[InteractionType$1.ModalSubmit]: ModalSubmitInteractionHandler;
|
|
512
|
+
[InteractionType$1.MessageComponent]: MessageComponentInteractionHandler;
|
|
513
|
+
};
|
|
514
|
+
/**
|
|
515
|
+
* Generic handler function type for any Discord interaction.
|
|
516
|
+
*
|
|
517
|
+
* @template T - The specific API interaction type (defaults to any interaction)
|
|
518
|
+
*/
|
|
519
|
+
type InteractionHandlerFunction<T extends APIInteraction$1 = APIInteraction$1> = (interaction: T) => void | Promise<void>;
|
|
520
|
+
type MessageComponentType = ComponentType$1.Button | ComponentType$1.StringSelect | ComponentType$1.UserSelect | ComponentType$1.RoleSelect | ComponentType$1.MentionableSelect | ComponentType$1.ChannelSelect;
|
|
450
521
|
type MessageComponentDataTypes = {
|
|
451
|
-
[ComponentType.Button]: APIMessageButtonInteractionData;
|
|
452
|
-
[ComponentType.StringSelect]: APIMessageStringSelectInteractionData;
|
|
453
|
-
[ComponentType.UserSelect]: APIMessageUserSelectInteractionData;
|
|
454
|
-
[ComponentType.RoleSelect]: APIMessageRoleSelectInteractionData;
|
|
455
|
-
[ComponentType.MentionableSelect]: APIMessageMentionableSelectInteractionData;
|
|
456
|
-
[ComponentType.ChannelSelect]: APIMessageChannelSelectInteractionData;
|
|
522
|
+
[ComponentType$1.Button]: APIMessageButtonInteractionData;
|
|
523
|
+
[ComponentType$1.StringSelect]: APIMessageStringSelectInteractionData;
|
|
524
|
+
[ComponentType$1.UserSelect]: APIMessageUserSelectInteractionData;
|
|
525
|
+
[ComponentType$1.RoleSelect]: APIMessageRoleSelectInteractionData;
|
|
526
|
+
[ComponentType$1.MentionableSelect]: APIMessageMentionableSelectInteractionData;
|
|
527
|
+
[ComponentType$1.ChannelSelect]: APIMessageChannelSelectInteractionData;
|
|
457
528
|
};
|
|
458
529
|
type MessageComponentInteractionPayload<T extends MessageComponentType = MessageComponentType> = Extract<ValidInteraction, {
|
|
459
|
-
type: InteractionType.MessageComponent;
|
|
530
|
+
type: InteractionType$1.MessageComponent;
|
|
460
531
|
data: MessageComponentDataTypes[T];
|
|
461
532
|
}>;
|
|
533
|
+
declare enum ContextCommandType {
|
|
534
|
+
User = 2,
|
|
535
|
+
Message = 3,
|
|
536
|
+
}
|
|
537
|
+
type BufferSource = ArrayBufferView | ArrayBuffer;
|
|
462
538
|
//#endregion
|
|
463
539
|
//#region src/interactions/AutocompleteInteraction.d.ts
|
|
464
|
-
declare class AutocompleteInteraction extends BaseInteraction<InteractionType.ApplicationCommandAutocomplete> {
|
|
540
|
+
declare class AutocompleteInteraction extends BaseInteraction<InteractionType$1.ApplicationCommandAutocomplete> {
|
|
465
541
|
readonly options: CommandInteractionOptionResolver;
|
|
466
542
|
responded: boolean;
|
|
467
543
|
constructor(api: API$1, interaction: APIApplicationCommandAutocompleteInteraction, c: BaseInteractionContext);
|
|
@@ -471,7 +547,7 @@ declare class AutocompleteInteraction extends BaseInteraction<InteractionType.Ap
|
|
|
471
547
|
}
|
|
472
548
|
//#endregion
|
|
473
549
|
//#region src/interactions/MessageContextCommandInteraction.d.ts
|
|
474
|
-
declare class MessageCommandInteraction extends BaseInteraction<InteractionType.ApplicationCommand> {
|
|
550
|
+
declare class MessageCommandInteraction extends BaseInteraction<InteractionType$1.ApplicationCommand> {
|
|
475
551
|
readonly targetMessage: APIMessage;
|
|
476
552
|
constructor(api: API$1, interaction: APIMessageApplicationCommandInteraction, c: BaseInteractionContext);
|
|
477
553
|
get commandName(): string;
|
|
@@ -480,7 +556,7 @@ declare class MessageCommandInteraction extends BaseInteraction<InteractionType.
|
|
|
480
556
|
}
|
|
481
557
|
//#endregion
|
|
482
558
|
//#region src/interactions/UserContextCommandInteraction.d.ts
|
|
483
|
-
declare class UserCommandInteraction extends BaseInteraction<InteractionType.ApplicationCommand> {
|
|
559
|
+
declare class UserCommandInteraction extends BaseInteraction<InteractionType$1.ApplicationCommand> {
|
|
484
560
|
readonly targetUser: APIUser;
|
|
485
561
|
constructor(api: API$1, interaction: APIUserApplicationCommandInteraction, c: BaseInteractionContext);
|
|
486
562
|
get commandName(): string;
|
|
@@ -534,7 +610,7 @@ declare class SlashCommandHandler extends SlashCommandBuilder {
|
|
|
534
610
|
addSubcommand(input: SlashCommandSubcommandBuilder | ((sub: SlashCommandSubcommandBuilder) => SlashCommandSubcommandBuilder)): this;
|
|
535
611
|
addSubcommandGroup(input: SlashCommandSubcommandGroupBuilder | ((group: SlashCommandSubcommandGroupBuilder) => SlashCommandSubcommandGroupBuilder)): this;
|
|
536
612
|
}
|
|
537
|
-
declare class ContextCommandHandler<T extends
|
|
613
|
+
declare class ContextCommandHandler<T extends ContextCommandType = ContextCommandType, InteractionData = (T extends ContextCommandType.User ? UserCommandInteraction : MessageCommandInteraction)> extends ContextMenuCommandBuilder {
|
|
538
614
|
readonly handlerType = "context";
|
|
539
615
|
private handlerFn?;
|
|
540
616
|
addHandler(handler: (interaction: InteractionData) => Promise<void> | void): ContextCommandHandler<T, InteractionData>;
|
|
@@ -755,5 +831,5 @@ declare function parseCustomId(customId: string, onlyPrefix?: false): {
|
|
|
755
831
|
lastParam: string | null;
|
|
756
832
|
};
|
|
757
833
|
//#endregion
|
|
758
|
-
export { type API, type APIChatInputApplicationCommandInteraction, type APIInteraction, type APIMessageComponentInteraction, type APIModalSubmitInteraction, ActionRowBuilder,
|
|
834
|
+
export { type API, type APIChatInputApplicationCommandInteraction, type APIInteraction, APIInteractionDataResolvedCollections, type APIMessageComponentInteraction, type APIModalSubmitInteraction, ActionRowBuilder, ApplicationCommandType, AutocompleteInteractionHandler, BaseBindings, BaseHonocordEnv, BaseInteraction, BaseInteractionContext, BaseVariables, BufferSource, ButtonBuilder, ChannelSelectMenuBuilder, ChannelType, ChatInputCommandInteraction, Collection, Colors, CommandInteractionHandler, CommandInteractionOptionResolver, ComponentHandler, ComponentType, ContainerBuilder, ContextCommandHandler, ContextCommandType, EmbedBuilder, FileBuilder, FileUploadBuilder, type Handler, Honocord, InteractionHandlerFunction, InteractionHandlers, InteractionType, LabelBuilder, MediaGalleryBuilder, MediaGalleryItemBuilder, MentionableSelectMenuBuilder, MessageComponentDataTypes, MessageComponentInteraction, MessageComponentInteractionHandler, MessageComponentInteractionPayload, MessageComponentType, ModalBuilder, ModalComponentResolver, ModalHandler, ModalInteraction, ModalSubmitInteractionHandler, type REST, type ReadonlyCollection, RoleSelectMenuBuilder, SectionBuilder, SelectMenuOptionBuilder, SeparatorBuilder, SlashCommandHandler, type Snowflake, StringSelectMenuBuilder, StringSelectMenuOptionBuilder, TextDisplayBuilder, TextInputBuilder, ThumbnailBuilder, UserSelectMenuBuilder, ValidInteraction, parseCustomId, registerCommands };
|
|
759
835
|
//# sourceMappingURL=index.d.mts.map
|
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/BaseInteraction.ts","../src/interactions/ChatInputInteraction.ts","../src/interactions/MessageComponentInteraction.ts","../src/types.ts","../src/interactions/AutocompleteInteraction.ts","../src/interactions/MessageContextCommandInteraction.ts","../src/interactions/UserContextCommandInteraction.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,KAAA,EAAA,MAAA;EAsBC;;;EAqBE,OAAA,EAAA,OAAA;CAIM;;;;cAzBR,gCAAA,CA4DU;EAAkD;;;EAAmB,QAAA,MAAA;E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,EAAA,QAAA;EAIM,SAAA,IAAA,EAAA,QAAA;EAuBG,SAAA,KAAA,EAAA,OAAA;EAAA,SAAA,IAAA,EAAA,OAAA;EAAA,SAAA,OAAA,EAAA,QAAA;EAYD,SAAA,SAAA,EAAA,QAAA;EAAkD,SAAA,iBAAA,EAAA,QAAA;EAAC,SAAA,IAAA,EAAA,OAAkB;EAcgC,SAAA,aAAA,EAAA,OAAA;EAdhC,SAAA,MAAA,EAAA,QAAA;EAAA,SAAA,MAAA,EAAA,QAAA;EAcgC,SAAA,GAAA,EAAA,QAAA;;;CAAA;;;iBa3G/F,gBAAA,4EAA4F,YAAS;;;iBCD3G,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/BaseInteraction.ts","../src/interactions/ChatInputInteraction.ts","../src/interactions/MessageComponentInteraction.ts","../src/types.ts","../src/interactions/AutocompleteInteraction.ts","../src/interactions/MessageContextCommandInteraction.ts","../src/interactions/UserContextCommandInteraction.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,QAAlB,uBAAA,CAAkB,oDAAA;I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,4 +1,4 @@
|
|
|
1
|
-
import { ApplicationCommandOptionType, ApplicationCommandType, ComponentType, InteractionResponseType, InteractionType } from "discord-api-types/v10";
|
|
1
|
+
import { ApplicationCommandOptionType, ApplicationCommandType, ApplicationCommandType as ApplicationCommandType$1, ChannelType, ComponentType, ComponentType as ComponentType$1, InteractionResponseType, InteractionType, InteractionType as InteractionType$1 } from "discord-api-types/v10";
|
|
2
2
|
import { Collection, Collection as Collection$1 } from "@discordjs/collection";
|
|
3
3
|
import { ActionRowBuilder, ButtonBuilder, ChannelSelectMenuBuilder, ContainerBuilder, ContextMenuCommandBuilder, EmbedBuilder, FileBuilder, FileUploadBuilder, LabelBuilder, MediaGalleryBuilder, MediaGalleryItemBuilder, MentionableSelectMenuBuilder, ModalBuilder, ModalBuilder as ModalBuilder$1, RoleSelectMenuBuilder, SectionBuilder, SelectMenuOptionBuilder, SeparatorBuilder, SlashCommandBuilder, StringSelectMenuBuilder, StringSelectMenuOptionBuilder, TextDisplayBuilder, TextInputBuilder, ThumbnailBuilder, UserSelectMenuBuilder } from "@discordjs/builders";
|
|
4
4
|
import { API } from "@discordjs/core/http-only";
|
|
@@ -232,22 +232,22 @@ var BaseInteraction = class {
|
|
|
232
232
|
return response;
|
|
233
233
|
}
|
|
234
234
|
isChatInputCommand() {
|
|
235
|
-
return this.type === InteractionType.ApplicationCommand;
|
|
235
|
+
return this.type === InteractionType$1.ApplicationCommand;
|
|
236
236
|
}
|
|
237
237
|
isMessageContext() {
|
|
238
|
-
return this.type === InteractionType.ApplicationCommand && "message" in this.data;
|
|
238
|
+
return this.type === InteractionType$1.ApplicationCommand && "message" in this.data;
|
|
239
239
|
}
|
|
240
240
|
isModal() {
|
|
241
|
-
return this.type === InteractionType.ModalSubmit;
|
|
241
|
+
return this.type === InteractionType$1.ModalSubmit;
|
|
242
242
|
}
|
|
243
243
|
isMessageComponent() {
|
|
244
|
-
return this.type === InteractionType.MessageComponent;
|
|
244
|
+
return this.type === InteractionType$1.MessageComponent;
|
|
245
245
|
}
|
|
246
246
|
isButton() {
|
|
247
|
-
return this.isMessageComponent() && this.data.component_type === ComponentType.Button;
|
|
247
|
+
return this.isMessageComponent() && this.data.component_type === ComponentType$1.Button;
|
|
248
248
|
}
|
|
249
249
|
isStringSelect() {
|
|
250
|
-
return this.isMessageComponent() && this.data.component_type === ComponentType.StringSelect;
|
|
250
|
+
return this.isMessageComponent() && this.data.component_type === ComponentType$1.StringSelect;
|
|
251
251
|
}
|
|
252
252
|
};
|
|
253
253
|
|
|
@@ -324,11 +324,8 @@ async function verifyKey(rawBody, signature, timestamp, clientPublicKey) {
|
|
|
324
324
|
if (!signature || !timestamp) return false;
|
|
325
325
|
try {
|
|
326
326
|
const message = concatUint8Arrays(valueToUint8Array(timestamp), valueToUint8Array(rawBody));
|
|
327
|
-
const publicKey = typeof clientPublicKey === "string" ? await subtleCrypto.importKey("raw", valueToUint8Array(clientPublicKey, "hex"), {
|
|
328
|
-
|
|
329
|
-
namedCurve: "ed25519"
|
|
330
|
-
}, false, ["verify"]) : clientPublicKey;
|
|
331
|
-
return await subtleCrypto.verify({ name: "ed25519" }, publicKey, valueToUint8Array(signature, "hex"), message);
|
|
327
|
+
const publicKey = typeof clientPublicKey === "string" ? await subtleCrypto.importKey("raw", valueToUint8Array(clientPublicKey, "hex").buffer, { name: "ed25519" }, false, ["verify"]) : clientPublicKey;
|
|
328
|
+
return await subtleCrypto.verify({ name: "ed25519" }, publicKey, valueToUint8Array(signature, "hex").buffer, message.buffer);
|
|
332
329
|
} catch (_ex) {
|
|
333
330
|
return false;
|
|
334
331
|
}
|
|
@@ -495,7 +492,7 @@ var ModalComponentResolver = class {
|
|
|
495
492
|
return acc;
|
|
496
493
|
}, {});
|
|
497
494
|
this.hoistedComponents = this.components.reduce((accumulator, next) => {
|
|
498
|
-
if (next.type === ComponentType.Label && next.component.type !== ComponentType.FileUpload) accumulator.set(next.component.custom_id, next.component);
|
|
495
|
+
if (next.type === ComponentType$1.Label && next.component.type !== ComponentType$1.FileUpload) accumulator.set(next.component.custom_id, next.component);
|
|
499
496
|
return accumulator;
|
|
500
497
|
}, new Collection$1());
|
|
501
498
|
}
|
|
@@ -509,7 +506,7 @@ var ModalComponentResolver = class {
|
|
|
509
506
|
}
|
|
510
507
|
getString(custom_id, required = false) {
|
|
511
508
|
const component = this.getComponent(custom_id);
|
|
512
|
-
if (component.type !== ComponentType.TextInput) throw new TypeError("Component is not a text input", { cause: {
|
|
509
|
+
if (component.type !== ComponentType$1.TextInput) throw new TypeError("Component is not a text input", { cause: {
|
|
513
510
|
custom_id,
|
|
514
511
|
type: component.type
|
|
515
512
|
} });
|
|
@@ -525,7 +522,7 @@ var ModalComponentResolver = class {
|
|
|
525
522
|
}
|
|
526
523
|
getSelectedChannels(custom_id, required = false) {
|
|
527
524
|
const component = this.getComponent(custom_id);
|
|
528
|
-
if (component.type !== ComponentType.ChannelSelect) throw new TypeError("Component is not a channel select", { cause: {
|
|
525
|
+
if (component.type !== ComponentType$1.ChannelSelect) throw new TypeError("Component is not a channel select", { cause: {
|
|
529
526
|
custom_id,
|
|
530
527
|
type: component.type
|
|
531
528
|
} });
|
|
@@ -534,7 +531,7 @@ var ModalComponentResolver = class {
|
|
|
534
531
|
}
|
|
535
532
|
getSelectedUsers(custom_id, required = false) {
|
|
536
533
|
const component = this.getComponent(custom_id);
|
|
537
|
-
if (component.type !== ComponentType.UserSelect) throw new TypeError("Component is not a user select", { cause: {
|
|
534
|
+
if (component.type !== ComponentType$1.UserSelect) throw new TypeError("Component is not a user select", { cause: {
|
|
538
535
|
custom_id,
|
|
539
536
|
type: component.type
|
|
540
537
|
} });
|
|
@@ -543,7 +540,7 @@ var ModalComponentResolver = class {
|
|
|
543
540
|
}
|
|
544
541
|
getSelectedMembers(custom_id, required = false) {
|
|
545
542
|
const component = this.getComponent(custom_id);
|
|
546
|
-
if (component.type !== ComponentType.UserSelect) throw new TypeError("Component is not a user select", { cause: {
|
|
543
|
+
if (component.type !== ComponentType$1.UserSelect) throw new TypeError("Component is not a user select", { cause: {
|
|
547
544
|
custom_id,
|
|
548
545
|
type: component.type
|
|
549
546
|
} });
|
|
@@ -552,7 +549,7 @@ var ModalComponentResolver = class {
|
|
|
552
549
|
}
|
|
553
550
|
getSelectedRoles(custom_id, required = false) {
|
|
554
551
|
const component = this.getComponent(custom_id);
|
|
555
|
-
if (component.type !== ComponentType.RoleSelect) throw new TypeError("Component is not a role select", { cause: {
|
|
552
|
+
if (component.type !== ComponentType$1.RoleSelect) throw new TypeError("Component is not a role select", { cause: {
|
|
556
553
|
custom_id,
|
|
557
554
|
type: component.type
|
|
558
555
|
} });
|
|
@@ -561,7 +558,7 @@ var ModalComponentResolver = class {
|
|
|
561
558
|
}
|
|
562
559
|
getSelectedMentionables(custom_id, required = false) {
|
|
563
560
|
const component = this.getComponent(custom_id);
|
|
564
|
-
if (component.type !== ComponentType.MentionableSelect) throw new TypeError("Component is not a mentionable select", { cause: {
|
|
561
|
+
if (component.type !== ComponentType$1.MentionableSelect) throw new TypeError("Component is not a mentionable select", { cause: {
|
|
565
562
|
custom_id,
|
|
566
563
|
type: component.type
|
|
567
564
|
} });
|
|
@@ -868,10 +865,10 @@ var Honocord = class {
|
|
|
868
865
|
}
|
|
869
866
|
createCommandInteraction(ctx, interaction, api) {
|
|
870
867
|
switch (interaction.data.type) {
|
|
871
|
-
case ApplicationCommandType.ChatInput: return new ChatInputCommandInteraction(api, interaction, ctx);
|
|
872
|
-
case ApplicationCommandType.User: return new UserCommandInteraction(api, interaction, ctx);
|
|
873
|
-
case ApplicationCommandType.Message: return new MessageCommandInteraction(api, interaction, ctx);
|
|
874
|
-
default: throw new Error(`Unsupported application command type: ${interaction.data.type} (${ApplicationCommandType[interaction.data.type]})`);
|
|
868
|
+
case ApplicationCommandType$1.ChatInput: return new ChatInputCommandInteraction(api, interaction, ctx);
|
|
869
|
+
case ApplicationCommandType$1.User: return new UserCommandInteraction(api, interaction, ctx);
|
|
870
|
+
case ApplicationCommandType$1.Message: return new MessageCommandInteraction(api, interaction, ctx);
|
|
871
|
+
default: throw new Error(`Unsupported application command type: ${interaction.data.type} (${ApplicationCommandType$1[interaction.data.type]})`);
|
|
875
872
|
}
|
|
876
873
|
}
|
|
877
874
|
async handleCommandInteraction(ctx, interaction, api) {
|
|
@@ -879,10 +876,10 @@ var Honocord = class {
|
|
|
879
876
|
const commandName = interaction.data.name;
|
|
880
877
|
const handler = this.commandHandlers.get(commandName);
|
|
881
878
|
if (handler) try {
|
|
882
|
-
if (handler instanceof SlashCommandHandler && interaction.data.type === ApplicationCommandType.ChatInput) await handler.execute(interactionObj);
|
|
879
|
+
if (handler instanceof SlashCommandHandler && interaction.data.type === ApplicationCommandType$1.ChatInput) await handler.execute(interactionObj);
|
|
883
880
|
else if (handler instanceof ContextCommandHandler) {
|
|
884
|
-
if (interaction.data.type === ApplicationCommandType.User) await handler.execute(interactionObj);
|
|
885
|
-
else if (interaction.data.type === ApplicationCommandType.Message) await handler.execute(interactionObj);
|
|
881
|
+
if (interaction.data.type === ApplicationCommandType$1.User) await handler.execute(interactionObj);
|
|
882
|
+
else if (interaction.data.type === ApplicationCommandType$1.Message) await handler.execute(interactionObj);
|
|
886
883
|
}
|
|
887
884
|
} catch (error) {
|
|
888
885
|
console.error(`Error executing command handler for "${commandName}":`, error);
|
|
@@ -936,11 +933,11 @@ var Honocord = class {
|
|
|
936
933
|
});
|
|
937
934
|
const api = new API(rest);
|
|
938
935
|
switch (interaction.type) {
|
|
939
|
-
case InteractionType.ApplicationCommand: return await this.handleCommandInteraction(ctx, interaction, api);
|
|
940
|
-
case InteractionType.MessageComponent: return await this.handleComponentInteraction(ctx, interaction, api);
|
|
941
|
-
case InteractionType.ModalSubmit: return await this.handleModalInteraction(ctx, interaction, api);
|
|
942
|
-
case InteractionType.ApplicationCommandAutocomplete: return await this.handleAutocompleteInteraction(ctx, interaction, api);
|
|
943
|
-
default: throw new Error(`Unknown interaction type: ${interaction.type} (${InteractionType[interaction.type]})`);
|
|
936
|
+
case InteractionType$1.ApplicationCommand: return await this.handleCommandInteraction(ctx, interaction, api);
|
|
937
|
+
case InteractionType$1.MessageComponent: return await this.handleComponentInteraction(ctx, interaction, api);
|
|
938
|
+
case InteractionType$1.ModalSubmit: return await this.handleModalInteraction(ctx, interaction, api);
|
|
939
|
+
case InteractionType$1.ApplicationCommandAutocomplete: return await this.handleAutocompleteInteraction(ctx, interaction, api);
|
|
940
|
+
default: throw new Error(`Unknown interaction type: ${interaction.type} (${InteractionType$1[interaction.type]})`);
|
|
944
941
|
}
|
|
945
942
|
}
|
|
946
943
|
/**
|
|
@@ -969,7 +966,7 @@ var Honocord = class {
|
|
|
969
966
|
console.log("No interaction found in request");
|
|
970
967
|
return c.text("No interaction found.", 400);
|
|
971
968
|
}
|
|
972
|
-
if (interaction.type === InteractionType.Ping) {
|
|
969
|
+
if (interaction.type === InteractionType$1.Ping) {
|
|
973
970
|
console.log("Received Discord Ping");
|
|
974
971
|
return c.json({ type: InteractionResponseType.Pong });
|
|
975
972
|
}
|
|
@@ -1012,5 +1009,5 @@ var Honocord = class {
|
|
|
1012
1009
|
};
|
|
1013
1010
|
|
|
1014
1011
|
//#endregion
|
|
1015
|
-
export { ActionRowBuilder, BaseInteraction, ButtonBuilder, ChannelSelectMenuBuilder, ChatInputCommandInteraction, Collection, Colors, CommandInteractionOptionResolver, ComponentHandler, ContainerBuilder, ContextCommandHandler, EmbedBuilder, FileBuilder, FileUploadBuilder, Honocord, LabelBuilder, MediaGalleryBuilder, MediaGalleryItemBuilder, MentionableSelectMenuBuilder, MessageComponentInteraction, ModalBuilder, ModalComponentResolver, ModalHandler, ModalInteraction, RoleSelectMenuBuilder, SectionBuilder, SelectMenuOptionBuilder, SeparatorBuilder, SlashCommandHandler, StringSelectMenuBuilder, StringSelectMenuOptionBuilder, TextDisplayBuilder, TextInputBuilder, ThumbnailBuilder, UserSelectMenuBuilder, parseCustomId, registerCommands };
|
|
1012
|
+
export { ActionRowBuilder, ApplicationCommandType, BaseInteraction, ButtonBuilder, ChannelSelectMenuBuilder, ChannelType, ChatInputCommandInteraction, Collection, Colors, CommandInteractionOptionResolver, ComponentHandler, ComponentType, ContainerBuilder, ContextCommandHandler, EmbedBuilder, FileBuilder, FileUploadBuilder, Honocord, InteractionType, LabelBuilder, MediaGalleryBuilder, MediaGalleryItemBuilder, MentionableSelectMenuBuilder, MessageComponentInteraction, ModalBuilder, ModalComponentResolver, ModalHandler, ModalInteraction, RoleSelectMenuBuilder, SectionBuilder, SelectMenuOptionBuilder, SeparatorBuilder, SlashCommandHandler, StringSelectMenuBuilder, StringSelectMenuOptionBuilder, TextDisplayBuilder, TextInputBuilder, ThumbnailBuilder, UserSelectMenuBuilder, parseCustomId, registerCommands };
|
|
1016
1013
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["Collection","ModalBuilder","ModalBuilder","ModalBuilder","ModalBuilder","Collection"],"sources":["../src/resolvers/CommandOptionResolver.ts","../src/interactions/BaseInteraction.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 APIInteractionResponseCallbackData,\n type Snowflake,\n APIApplicationCommandAutocompleteInteraction,\n APIApplicationCommandInteraction,\n APIChatInputApplicationCommandInteraction,\n APIInteraction,\n APIMessageApplicationCommandInteraction,\n APIMessageComponentInteraction,\n APIModalSubmitInteraction,\n APIPartialInteractionGuild,\n APIUser,\n ComponentType,\n InteractionType,\n Locale,\n} from \"discord-api-types/v10\";\nimport { API } from \"@discordjs/core/http-only\";\nimport { REST } from \"@discordjs/rest\";\nimport { ChatInputCommandInteraction } from \"./ChatInputInteraction\";\nimport { ModalInteraction } from \"./ModalInteraction\";\nimport type { BaseInteractionContext } from \"../types\";\n\nabstract class BaseInteraction<Type extends InteractionType> {\n public readonly type: Type;\n protected readonly data: Extract<APIInteraction, { 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: BaseInteractionContext;\n\n constructor(\n protected api: API,\n data: typeof this.data,\n context: BaseInteractionContext\n ) {\n this.type = data.type as Type;\n this.data = data;\n this.rest = api.rest;\n this.context = context;\n }\n\n get applicationId() {\n return this.data.application_id;\n }\n\n get entitlements() {\n return this.data.entitlements;\n }\n\n get channelId() {\n return this.data.channel?.id;\n }\n\n get channel() {\n return this.data.channel;\n }\n\n get guildId() {\n return this.data.guild_id;\n }\n\n get guild() {\n return this.data.guild;\n }\n\n get userId() {\n return this.data.user?.id;\n }\n\n get user() {\n return (this.data.member?.user || this.data.user) as APIUser; // One is always given.\n }\n\n get member() {\n return this.data.member;\n }\n\n get locale() {\n return this.data.guild_locale;\n }\n\n get guildLocale() {\n return this.data.guild_locale;\n }\n\n get token() {\n return this.data.token;\n }\n\n get id() {\n return this.data.id;\n }\n\n get appPermissions() {\n return this.data.app_permissions;\n }\n\n get version() {\n return this.data.version;\n }\n\n inGuild(): this is BaseInteraction<Type> & { guild_id: Snowflake; guild: APIPartialInteractionGuild; guild_locale: Locale } {\n return Boolean(this.data.guild_id && this.data.guild && this.data.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 async reply(options: APIInteractionResponseCallbackData | 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(this.id, this.token, replyOptions, {\n signal: AbortSignal.timeout(5000),\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 });\n this.deferred = true;\n return response;\n }\n\n deferUpdate() {\n return this.api.interactions.deferMessageUpdate(this.id, this.token);\n }\n\n async editReply(options: APIInteractionResponseCallbackData | string, messageId: Snowflake | \"@original\" = \"@original\") {\n const replyOptions = typeof options === \"string\" ? { content: options } : options;\n const response = await this.api.interactions.editReply(this.applicationId, this.token, replyOptions, messageId, {\n signal: AbortSignal.timeout(5000),\n });\n this.replied = true;\n return response;\n }\n\n deleteReply(messageId?: Snowflake | \"@original\") {\n return this.api.interactions.deleteReply(this.applicationId, this.token, messageId);\n }\n\n async update(options: APIInteractionResponseCallbackData | string) {\n const updateOptions = typeof options === \"string\" ? { content: options } : options;\n const response = await this.api.interactions.updateMessage(this.id, this.token, updateOptions, {\n signal: AbortSignal.timeout(5000),\n });\n this.replied = true;\n return response;\n }\n\n // Typeguards\n isChatInputCommand(): this is ChatInputCommandInteraction {\n return this.type === InteractionType.ApplicationCommand;\n }\n\n isMessageContext(): this is APIMessageApplicationCommandInteraction {\n return this.type === InteractionType.ApplicationCommand && \"message\" in this.data;\n }\n\n isModal(): this is ModalInteraction {\n return this.type === InteractionType.ModalSubmit;\n }\n\n isMessageComponent(): this is APIMessageComponentInteraction {\n return this.type === InteractionType.MessageComponent;\n }\n\n isButton(): this is APIMessageComponentInteraction & { data: { component_type: ComponentType.Button } } {\n return this.isMessageComponent() && this.data.component_type === ComponentType.Button;\n }\n\n isStringSelect(): this is APIMessageComponentInteraction & {\n data: { component_type: Exclude<ComponentType, ComponentType.StringSelect> };\n } {\n return this.isMessageComponent() && this.data.component_type === ComponentType.StringSelect;\n }\n}\n\nexport { BaseInteraction };\n","import {\n InteractionType,\n type APIChatInputApplicationCommandInteraction,\n type APIModalInteractionResponseCallbackData,\n} from \"discord-api-types/v10\";\nimport { CommandInteractionOptionResolver } from \"@resolvers/CommandOptionResolver\";\nimport { ModalBuilder } from \"@discordjs/builders\";\nimport { API } from \"@discordjs/core/http-only\";\nimport { BaseInteraction } from \"./BaseInteraction\";\nimport { BaseInteractionContext } from \"../types\";\n\nclass ChatInputCommandInteraction extends BaseInteraction<InteractionType.ApplicationCommand> {\n public readonly options: CommandInteractionOptionResolver;\n\n constructor(api: API, interaction: APIChatInputApplicationCommandInteraction, c: BaseInteractionContext) {\n super(api, interaction, c);\n this.options = new CommandInteractionOptionResolver(interaction.data.options, interaction.data.resolved);\n }\n\n get commandName() {\n return this.data.data.name;\n }\n\n get commandId() {\n return this.data.data.id;\n }\n\n showModal(data: APIModalInteractionResponseCallbackData | ModalBuilder) {\n return this.api.interactions.createModal(this.id, this.token, data instanceof ModalBuilder ? data.toJSON() : data);\n }\n}\n\nexport { ChatInputCommandInteraction };\n","import type { APIInteraction, APIWebhookEvent } from \"discord-api-types/v10\";\nimport { cloneRawRequest, type HonoRequest } from \"hono/request\";\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\"),\n {\n name: \"ed25519\",\n namedCurve: \"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\"),\n message\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\nexport const 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} as const;\n","import { Handler } from \"@ctx/handlers\";\nimport { API } from \"@discordjs/core/http-only\";\nimport { REST } from \"@discordjs/rest\";\n\nexport async function registerCommands(token: string | undefined, applicationId: string | undefined, ...handlers: Handler[]) {\n const commands = handlers\n .map((handler) => {\n if (handler.handlerType === \"slash\" || handler.handlerType === \"context\") {\n return handler.toJSON();\n }\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 commands.\");\n } catch (error) {\n console.error(\"❌ Error registering 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 {\n APIUserApplicationCommandInteraction,\n APIUser,\n InteractionType,\n type APIModalInteractionResponseCallbackData,\n} from \"discord-api-types/v10\";\nimport { ModalBuilder } from \"@discordjs/builders\";\nimport { API } from \"@discordjs/core/http-only\";\nimport { BaseInteraction } from \"./BaseInteraction\";\nimport { BaseInteractionContext } from \"../types\";\n\nclass UserCommandInteraction extends BaseInteraction<InteractionType.ApplicationCommand> {\n public readonly targetUser: APIUser;\n\n constructor(api: API, interaction: APIUserApplicationCommandInteraction, c: BaseInteractionContext) {\n super(api, interaction, c);\n this.targetUser = interaction.data.resolved.users[interaction.data.target_id];\n }\n\n get commandName() {\n return this.data.data.name;\n }\n\n get commandId() {\n return this.data.data.id;\n }\n\n showModal(data: APIModalInteractionResponseCallbackData | ModalBuilder) {\n return this.api.interactions.createModal(this.id, this.token, data instanceof ModalBuilder ? data.toJSON() : data);\n }\n}\n\nexport { UserCommandInteraction };\n","import {\n APIMessage,\n APIMessageApplicationCommandInteraction,\n InteractionType,\n type APIModalInteractionResponseCallbackData,\n} from \"discord-api-types/v10\";\nimport { ModalBuilder } from \"@discordjs/builders\";\nimport { API } from \"@discordjs/core/http-only\";\nimport { BaseInteraction } from \"./BaseInteraction\";\nimport { BaseInteractionContext } from \"../types\";\n\nclass MessageCommandInteraction extends BaseInteraction<InteractionType.ApplicationCommand> {\n public readonly targetMessage: APIMessage;\n\n constructor(api: API, interaction: APIMessageApplicationCommandInteraction, c: BaseInteractionContext) {\n super(api, interaction, c);\n this.targetMessage = interaction.data.resolved.messages[interaction.data.target_id];\n }\n\n get commandName() {\n return this.data.data.name;\n }\n\n get commandId() {\n return this.data.data.id;\n }\n\n showModal(data: APIModalInteractionResponseCallbackData | ModalBuilder) {\n return this.api.interactions.createModal(this.id, this.token, data instanceof ModalBuilder ? data.toJSON() : data);\n }\n}\n\nexport { MessageCommandInteraction };\n","import { APIMessage, APIModalInteractionResponseCallbackData, InteractionType } from \"discord-api-types/v10\";\nimport { API } from \"@discordjs/core/http-only\";\nimport { BaseInteraction } from \"./BaseInteraction\";\nimport { ModalBuilder } from \"@discordjs/builders\";\nimport type { BaseInteractionContext, MessageComponentInteractionPayload, MessageComponentType } from \"../types\";\n\nclass MessageComponentInteraction<\n T extends MessageComponentType = MessageComponentType,\n> extends BaseInteraction<InteractionType.MessageComponent> {\n public readonly message?: APIMessage;\n public readonly custom_id: string;\n constructor(api: API, interaction: MessageComponentInteractionPayload<T>, c: BaseInteractionContext) {\n super(api, interaction, c);\n this.custom_id = interaction.data.custom_id;\n\n if (\"message\" in interaction && interaction.message) {\n this.message = interaction.message;\n }\n }\n\n showModal(data: APIModalInteractionResponseCallbackData | ModalBuilder) {\n return this.api.interactions.createModal(this.id, this.token, data instanceof ModalBuilder ? data.toJSON() : data);\n }\n}\n\nexport { MessageComponentInteraction };\n","import {\n APIBaseComponent,\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 extends BaseInteraction<InteractionType.ModalSubmit> {\n public readonly fields: ModalComponentResolver;\n public readonly message?: APIMessage;\n public readonly custom_id: string;\n\n constructor(api: API, interaction: APIModalSubmitInteraction, c: BaseInteractionContext) {\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 extends BaseInteraction<InteractionType.ApplicationCommandAutocomplete> {\n public readonly options: CommandInteractionOptionResolver;\n public responded = false;\n\n constructor(api: API, interaction: APIApplicationCommandAutocompleteInteraction, c: BaseInteractionContext) {\n super(api, interaction, c);\n this.options = new CommandInteractionOptionResolver(interaction.data.options, interaction.data.resolved);\n }\n\n get commandName() {\n return this.data.data.name;\n }\n\n get commandId() {\n return this.data.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 { ApplicationCommandType } from \"discord-api-types/v10\";\nimport { MessageCommandInteraction } from \"./MessageContextCommandInteraction\";\nimport { UserCommandInteraction } from \"./UserContextCommandInteraction\";\nimport { parseCustomId } from \"@utils/index\";\nimport { MessageComponentInteractionPayload, MessageComponentType } from \"../types\";\n\n/**\n * Handler for chat input commands with optional autocomplete support\n */\nexport class SlashCommandHandler extends SlashCommandBuilder {\n readonly handlerType = \"slash\";\n private handlerFn?: (interaction: ChatInputCommandInteraction) => Promise<void> | void;\n private autocompleteFn?: (interaction: AutocompleteInteraction) => Promise<void> | void;\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(handler: (interaction: ChatInputCommandInteraction) => Promise<void> | void): SlashCommandHandler {\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(handler: (interaction: AutocompleteInteraction) => Promise<void> | void): SlashCommandHandler {\n this.autocompleteFn = handler;\n return this;\n }\n\n /**\n * Executes the command handler\n */\n async execute(interaction: ChatInputCommandInteraction): 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): 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 ApplicationCommandType = ApplicationCommandType,\n InteractionData = T extends ApplicationCommandType.User ? UserCommandInteraction : MessageCommandInteraction,\n> extends ContextMenuCommandBuilder {\n readonly handlerType = \"context\";\n private handlerFn?: (interaction: InteractionData) => Promise<void> | void;\n\n public addHandler(handler: (interaction: InteractionData) => Promise<void> | void): ContextCommandHandler<T, 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<T extends MessageComponentType = MessageComponentType> {\n readonly handlerType = \"component\";\n public readonly prefix: string;\n private handlerFn?: (interaction: MessageComponentInteraction<T>) => Promise<void> | void;\n\n constructor(prefix: string, handler?: (interaction: MessageComponentInteraction<T>) => Promise<void> | void) {\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(handler: (interaction: MessageComponentInteraction<T>) => Promise<void> | void): ComponentHandler<T> {\n this.handlerFn = handler;\n return this;\n }\n\n /**\n * Executes the component handler\n */\n async execute(interaction: MessageComponentInteraction<T>): 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 {\n readonly handlerType = \"modal\";\n public readonly prefix: string;\n private handlerFn?: (interaction: ModalInteraction) => Promise<void> | void;\n\n constructor(prefix: string, handler?: (interaction: ModalInteraction) => Promise<void> | void) {\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) => Promise<void> | void): ModalHandler {\n this.handlerFn = handler;\n return this;\n }\n\n /**\n * Executes the modal handler\n */\n async execute(interaction: ModalInteraction): 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 = SlashCommandHandler | ContextCommandHandler | ComponentHandler | ModalHandler;\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} from \"./types\";\nimport { UserCommandInteraction } from \"@ctx/UserContextCommandInteraction\";\nimport { MessageCommandInteraction } 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: Map<string, SlashCommandHandler | ContextCommandHandler> = new Map();\n private componentHandlers: ComponentHandler[] = [];\n private modalHandlers: 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 * @example\n * ```typescript\n * import { HonoCord, CommandHandler, ComponentHandler, ModalHandler, HonocordSlashCommandBuilder } from \"honocord\";\n *\n * const honoCord = new Honocord();\n *\n * // Command handler with autocomplete\n * const searchCommand = new HonocordSlashCommandBuilder()\n * .setName(\"search\")\n * .setDescription(\"Search for something\")\n * .addStringOption(option =>\n * option.setName(\"query\")\n * .setDescription(\"Search query\")\n * .setAutocomplete(true)\n * )\n * .handler(async (interaction) => {\n * const query = interaction.options.getString(\"query\", true);\n * await interaction.reply(`Searching for: ${query}`);\n * })\n * .autocomplete(async (interaction) => {\n * const focused = interaction.options.getFocused();\n * await interaction.respond([\n * { name: \"Option 1\", value: \"opt1\" },\n * { name: \"Option 2\", value: \"opt2\" }\n * ]);\n * });\n *\n * // Component handler (for buttons, select menus with custom_id prefix)\n * const buttonHandler = new ComponentHandler(\"mybutton\", async (interaction) => {\n * await interaction.reply(\"Button clicked!\");\n * });\n *\n * // Modal handler (for modals with custom_id prefix)\n * const modalHandler = new ModalHandler(\"mymodal\", async (interaction) => {\n * const value = interaction.fields.getTextInputValue(\"field_id\");\n * await interaction.reply(`You submitted: ${value}`);\n * });\n *\n * honoCord.loadHandlers(\n * new CommandHandler(searchCommand),\n * buttonHandler,\n * modalHandler\n * );\n * ```\n */\n loadHandlers(...handlers: Handler[]): void {\n for (const handler of handlers) {\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 // Check for duplicate prefixes\n const existing = this.componentHandlers.find((h) => h.prefix === handler.prefix);\n if (existing) {\n console.warn(`Component handler with prefix \"${handler.prefix}\" already exists. Overwriting.`);\n this.componentHandlers = this.componentHandlers.filter((h) => h.prefix !== handler.prefix);\n }\n this.componentHandlers.push(handler);\n } else if (handler instanceof ModalHandler) {\n // Check for duplicate prefixes\n const existing = this.modalHandlers.find((h) => h.prefix === handler.prefix);\n if (existing) {\n console.warn(`Modal handler with prefix \"${handler.prefix}\" already exists. Overwriting.`);\n this.modalHandlers = this.modalHandlers.filter((h) => h.prefix !== handler.prefix);\n }\n this.modalHandlers.push(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 UserCommandInteraction(api, interaction as any, ctx);\n case ApplicationCommandType.Message:\n return new MessageCommandInteraction(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 UserCommandInteraction);\n } else if (interaction.data.type === ApplicationCommandType.Message) {\n await handler.execute(interactionObj as MessageCommandInteraction);\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 // Find matching handler by prefix\n const handler = this.componentHandlers.find((h) => h.matches(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 // Find matching handler by prefix\n const handler = this.modalHandlers.find((h) => h.matches(customId));\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 * It is important, that\n *\n * @example\n * ```typescript\n * import { Hono } from \"hono\";\n * import { HonoCord } from \"honocord\";\n *\n * const app = new Hono();\n * const honoCord = new Honocord();\n *\n * app.post(\"/interactions\", honoCord.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,OAAO,QAAQ,aAAa,GAAG,EAAE,CAAC;AAEnF,UAAO;KACN,EAAE,CAAmD;AAGxD,MAAI,KAAK,gBAAgB,IAAI,SAAS,6BAA6B,iBAAiB;AAClF,QAAK,SAAS,KAAK,gBAAgB,GAAG;AACtC,QAAK,kBAAkB,KAAK,gBAAgB,GAAG,WAAW,EAAE;;AAI9D,MAAI,KAAK,gBAAgB,IAAI,SAAS,6BA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C;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","ComponentType","ModalBuilder","ModalBuilder","ModalBuilder","ModalBuilder","Collection","ComponentType","ApplicationCommandType","InteractionType"],"sources":["../src/resolvers/CommandOptionResolver.ts","../src/interactions/BaseInteraction.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 APIInteractionResponseCallbackData,\n type Snowflake,\n APIApplicationCommandAutocompleteInteraction,\n APIApplicationCommandInteraction,\n APIChatInputApplicationCommandInteraction,\n APIInteraction,\n APIMessageApplicationCommandInteraction,\n APIMessageComponentInteraction,\n APIModalSubmitInteraction,\n APIPartialInteractionGuild,\n APIUser,\n ComponentType,\n InteractionType,\n Locale,\n} from \"discord-api-types/v10\";\nimport { API } from \"@discordjs/core/http-only\";\nimport { REST } from \"@discordjs/rest\";\nimport { ChatInputCommandInteraction } from \"./ChatInputInteraction\";\nimport { ModalInteraction } from \"./ModalInteraction\";\nimport type { BaseInteractionContext } from \"../types\";\n\nabstract class BaseInteraction<Type extends InteractionType> {\n public readonly type: Type;\n protected readonly data: Extract<APIInteraction, { 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: BaseInteractionContext;\n\n constructor(\n protected api: API,\n data: typeof this.data,\n context: BaseInteractionContext\n ) {\n this.type = data.type as Type;\n this.data = data;\n this.rest = api.rest;\n this.context = context;\n }\n\n get applicationId() {\n return this.data.application_id;\n }\n\n get entitlements() {\n return this.data.entitlements;\n }\n\n get channelId() {\n return this.data.channel?.id;\n }\n\n get channel() {\n return this.data.channel;\n }\n\n get guildId() {\n return this.data.guild_id;\n }\n\n get guild() {\n return this.data.guild;\n }\n\n get userId() {\n return this.data.user?.id;\n }\n\n get user() {\n return (this.data.member?.user || this.data.user) as APIUser; // One is always given.\n }\n\n get member() {\n return this.data.member;\n }\n\n get locale() {\n return this.data.guild_locale;\n }\n\n get guildLocale() {\n return this.data.guild_locale;\n }\n\n get token() {\n return this.data.token;\n }\n\n get id() {\n return this.data.id;\n }\n\n get appPermissions() {\n return this.data.app_permissions;\n }\n\n get version() {\n return this.data.version;\n }\n\n inGuild(): this is BaseInteraction<Type> & { guild_id: Snowflake; guild: APIPartialInteractionGuild; guild_locale: Locale } {\n return Boolean(this.data.guild_id && this.data.guild && this.data.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 async reply(options: APIInteractionResponseCallbackData | 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(this.id, this.token, replyOptions, {\n signal: AbortSignal.timeout(5000),\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 });\n this.deferred = true;\n return response;\n }\n\n deferUpdate() {\n return this.api.interactions.deferMessageUpdate(this.id, this.token);\n }\n\n async editReply(options: APIInteractionResponseCallbackData | string, messageId: Snowflake | \"@original\" = \"@original\") {\n const replyOptions = typeof options === \"string\" ? { content: options } : options;\n const response = await this.api.interactions.editReply(this.applicationId, this.token, replyOptions, messageId, {\n signal: AbortSignal.timeout(5000),\n });\n this.replied = true;\n return response;\n }\n\n deleteReply(messageId?: Snowflake | \"@original\") {\n return this.api.interactions.deleteReply(this.applicationId, this.token, messageId);\n }\n\n async update(options: APIInteractionResponseCallbackData | string) {\n const updateOptions = typeof options === \"string\" ? { content: options } : options;\n const response = await this.api.interactions.updateMessage(this.id, this.token, updateOptions, {\n signal: AbortSignal.timeout(5000),\n });\n this.replied = true;\n return response;\n }\n\n // Typeguards\n isChatInputCommand(): this is ChatInputCommandInteraction {\n return this.type === InteractionType.ApplicationCommand;\n }\n\n isMessageContext(): this is APIMessageApplicationCommandInteraction {\n return this.type === InteractionType.ApplicationCommand && \"message\" in this.data;\n }\n\n isModal(): this is ModalInteraction {\n return this.type === InteractionType.ModalSubmit;\n }\n\n isMessageComponent(): this is APIMessageComponentInteraction {\n return this.type === InteractionType.MessageComponent;\n }\n\n isButton(): this is APIMessageComponentInteraction & { data: { component_type: ComponentType.Button } } {\n return this.isMessageComponent() && this.data.component_type === ComponentType.Button;\n }\n\n isStringSelect(): this is APIMessageComponentInteraction & {\n data: { component_type: Exclude<ComponentType, ComponentType.StringSelect> };\n } {\n return this.isMessageComponent() && this.data.component_type === ComponentType.StringSelect;\n }\n}\n\nexport { BaseInteraction };\n","import {\n InteractionType,\n type APIChatInputApplicationCommandInteraction,\n type APIModalInteractionResponseCallbackData,\n} from \"discord-api-types/v10\";\nimport { CommandInteractionOptionResolver } from \"@resolvers/CommandOptionResolver\";\nimport { ModalBuilder } from \"@discordjs/builders\";\nimport { API } from \"@discordjs/core/http-only\";\nimport { BaseInteraction } from \"./BaseInteraction\";\nimport { BaseInteractionContext } from \"../types\";\n\nclass ChatInputCommandInteraction extends BaseInteraction<InteractionType.ApplicationCommand> {\n public readonly options: CommandInteractionOptionResolver;\n\n constructor(api: API, interaction: APIChatInputApplicationCommandInteraction, c: BaseInteractionContext) {\n super(api, interaction, c);\n this.options = new CommandInteractionOptionResolver(interaction.data.options, interaction.data.resolved);\n }\n\n get commandName() {\n return this.data.data.name;\n }\n\n get commandId() {\n return this.data.data.id;\n }\n\n showModal(data: APIModalInteractionResponseCallbackData | ModalBuilder) {\n return this.api.interactions.createModal(this.id, this.token, data instanceof ModalBuilder ? data.toJSON() : data);\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\nexport const 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} as const;\n","import { Handler } from \"@ctx/handlers\";\nimport { API } from \"@discordjs/core/http-only\";\nimport { REST } from \"@discordjs/rest\";\n\nexport async function registerCommands(token: string | undefined, applicationId: string | undefined, ...handlers: Handler[]) {\n const commands = handlers\n .map((handler) => {\n if (handler.handlerType === \"slash\" || handler.handlerType === \"context\") {\n return handler.toJSON();\n }\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 commands.\");\n } catch (error) {\n console.error(\"❌ Error registering 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 {\n APIUserApplicationCommandInteraction,\n APIUser,\n InteractionType,\n type APIModalInteractionResponseCallbackData,\n} from \"discord-api-types/v10\";\nimport { ModalBuilder } from \"@discordjs/builders\";\nimport { API } from \"@discordjs/core/http-only\";\nimport { BaseInteraction } from \"./BaseInteraction\";\nimport { BaseInteractionContext } from \"../types\";\n\nclass UserCommandInteraction extends BaseInteraction<InteractionType.ApplicationCommand> {\n public readonly targetUser: APIUser;\n\n constructor(api: API, interaction: APIUserApplicationCommandInteraction, c: BaseInteractionContext) {\n super(api, interaction, c);\n this.targetUser = interaction.data.resolved.users[interaction.data.target_id];\n }\n\n get commandName() {\n return this.data.data.name;\n }\n\n get commandId() {\n return this.data.data.id;\n }\n\n showModal(data: APIModalInteractionResponseCallbackData | ModalBuilder) {\n return this.api.interactions.createModal(this.id, this.token, data instanceof ModalBuilder ? data.toJSON() : data);\n }\n}\n\nexport { UserCommandInteraction };\n","import {\n APIMessage,\n APIMessageApplicationCommandInteraction,\n InteractionType,\n type APIModalInteractionResponseCallbackData,\n} from \"discord-api-types/v10\";\nimport { ModalBuilder } from \"@discordjs/builders\";\nimport { API } from \"@discordjs/core/http-only\";\nimport { BaseInteraction } from \"./BaseInteraction\";\nimport { BaseInteractionContext } from \"../types\";\n\nclass MessageCommandInteraction extends BaseInteraction<InteractionType.ApplicationCommand> {\n public readonly targetMessage: APIMessage;\n\n constructor(api: API, interaction: APIMessageApplicationCommandInteraction, c: BaseInteractionContext) {\n super(api, interaction, c);\n this.targetMessage = interaction.data.resolved.messages[interaction.data.target_id];\n }\n\n get commandName() {\n return this.data.data.name;\n }\n\n get commandId() {\n return this.data.data.id;\n }\n\n showModal(data: APIModalInteractionResponseCallbackData | ModalBuilder) {\n return this.api.interactions.createModal(this.id, this.token, data instanceof ModalBuilder ? data.toJSON() : data);\n }\n}\n\nexport { MessageCommandInteraction };\n","import { APIMessage, APIModalInteractionResponseCallbackData, InteractionType } from \"discord-api-types/v10\";\nimport { API } from \"@discordjs/core/http-only\";\nimport { BaseInteraction } from \"./BaseInteraction\";\nimport { ModalBuilder } from \"@discordjs/builders\";\nimport type { BaseInteractionContext, MessageComponentInteractionPayload, MessageComponentType } from \"../types\";\n\nclass MessageComponentInteraction<\n T extends MessageComponentType = MessageComponentType,\n> extends BaseInteraction<InteractionType.MessageComponent> {\n public readonly message?: APIMessage;\n public readonly custom_id: string;\n constructor(api: API, interaction: MessageComponentInteractionPayload<T>, c: BaseInteractionContext) {\n super(api, interaction, c);\n this.custom_id = interaction.data.custom_id;\n\n if (\"message\" in interaction && interaction.message) {\n this.message = interaction.message;\n }\n }\n\n showModal(data: APIModalInteractionResponseCallbackData | ModalBuilder) {\n return this.api.interactions.createModal(this.id, this.token, data instanceof ModalBuilder ? data.toJSON() : data);\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 extends BaseInteraction<InteractionType.ModalSubmit> {\n public readonly fields: ModalComponentResolver;\n public readonly message?: APIMessage;\n public readonly custom_id: string;\n\n constructor(api: API, interaction: APIModalSubmitInteraction, c: BaseInteractionContext) {\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 extends BaseInteraction<InteractionType.ApplicationCommandAutocomplete> {\n public readonly options: CommandInteractionOptionResolver;\n public responded = false;\n\n constructor(api: API, interaction: APIApplicationCommandAutocompleteInteraction, c: BaseInteractionContext) {\n super(api, interaction, c);\n this.options = new CommandInteractionOptionResolver(interaction.data.options, interaction.data.resolved);\n }\n\n get commandName() {\n return this.data.data.name;\n }\n\n get commandId() {\n return this.data.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 { MessageCommandInteraction } from \"./MessageContextCommandInteraction\";\nimport { UserCommandInteraction } from \"./UserContextCommandInteraction\";\nimport { parseCustomId } from \"@utils/index\";\nimport { ContextCommandType, MessageComponentType } from \"../types\";\n\n/**\n * Handler for chat input commands with optional autocomplete support\n */\nexport class SlashCommandHandler extends SlashCommandBuilder {\n readonly handlerType = \"slash\";\n private handlerFn?: (interaction: ChatInputCommandInteraction) => Promise<void> | void;\n private autocompleteFn?: (interaction: AutocompleteInteraction) => Promise<void> | void;\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(handler: (interaction: ChatInputCommandInteraction) => Promise<void> | void): SlashCommandHandler {\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(handler: (interaction: AutocompleteInteraction) => Promise<void> | void): SlashCommandHandler {\n this.autocompleteFn = handler;\n return this;\n }\n\n /**\n * Executes the command handler\n */\n async execute(interaction: ChatInputCommandInteraction): 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): 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 InteractionData = T extends ContextCommandType.User ? UserCommandInteraction : MessageCommandInteraction,\n> extends ContextMenuCommandBuilder {\n readonly handlerType = \"context\";\n private handlerFn?: (interaction: InteractionData) => Promise<void> | void;\n\n public addHandler(handler: (interaction: InteractionData) => Promise<void> | void): ContextCommandHandler<T, 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<T extends MessageComponentType = MessageComponentType> {\n readonly handlerType = \"component\";\n public readonly prefix: string;\n private handlerFn?: (interaction: MessageComponentInteraction<T>) => Promise<void> | void;\n\n constructor(prefix: string, handler?: (interaction: MessageComponentInteraction<T>) => Promise<void> | void) {\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(handler: (interaction: MessageComponentInteraction<T>) => Promise<void> | void): ComponentHandler<T> {\n this.handlerFn = handler;\n return this;\n }\n\n /**\n * Executes the component handler\n */\n async execute(interaction: MessageComponentInteraction<T>): 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 {\n readonly handlerType = \"modal\";\n public readonly prefix: string;\n private handlerFn?: (interaction: ModalInteraction) => Promise<void> | void;\n\n constructor(prefix: string, handler?: (interaction: ModalInteraction) => Promise<void> | void) {\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) => Promise<void> | void): ModalHandler {\n this.handlerFn = handler;\n return this;\n }\n\n /**\n * Executes the modal handler\n */\n async execute(interaction: ModalInteraction): 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 = SlashCommandHandler | ContextCommandHandler | ComponentHandler | ModalHandler;\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} from \"./types\";\nimport { UserCommandInteraction } from \"@ctx/UserContextCommandInteraction\";\nimport { MessageCommandInteraction } 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: Map<string, SlashCommandHandler | ContextCommandHandler> = new Map();\n private componentHandlers: ComponentHandler[] = [];\n private modalHandlers: 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 * @example\n * ```typescript\n * import { HonoCord, CommandHandler, ComponentHandler, ModalHandler, HonocordSlashCommandBuilder } from \"honocord\";\n *\n * const honoCord = new Honocord();\n *\n * // Command handler with autocomplete\n * const searchCommand = new HonocordSlashCommandBuilder()\n * .setName(\"search\")\n * .setDescription(\"Search for something\")\n * .addStringOption(option =>\n * option.setName(\"query\")\n * .setDescription(\"Search query\")\n * .setAutocomplete(true)\n * )\n * .handler(async (interaction) => {\n * const query = interaction.options.getString(\"query\", true);\n * await interaction.reply(`Searching for: ${query}`);\n * })\n * .autocomplete(async (interaction) => {\n * const focused = interaction.options.getFocused();\n * await interaction.respond([\n * { name: \"Option 1\", value: \"opt1\" },\n * { name: \"Option 2\", value: \"opt2\" }\n * ]);\n * });\n *\n * // Component handler (for buttons, select menus with custom_id prefix)\n * const buttonHandler = new ComponentHandler(\"mybutton\", async (interaction) => {\n * await interaction.reply(\"Button clicked!\");\n * });\n *\n * // Modal handler (for modals with custom_id prefix)\n * const modalHandler = new ModalHandler(\"mymodal\", async (interaction) => {\n * const value = interaction.fields.getTextInputValue(\"field_id\");\n * await interaction.reply(`You submitted: ${value}`);\n * });\n *\n * honoCord.loadHandlers(\n * new CommandHandler(searchCommand),\n * buttonHandler,\n * modalHandler\n * );\n * ```\n */\n loadHandlers(...handlers: Handler[]): void {\n for (const handler of handlers) {\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 // Check for duplicate prefixes\n const existing = this.componentHandlers.find((h) => h.prefix === handler.prefix);\n if (existing) {\n console.warn(`Component handler with prefix \"${handler.prefix}\" already exists. Overwriting.`);\n this.componentHandlers = this.componentHandlers.filter((h) => h.prefix !== handler.prefix);\n }\n this.componentHandlers.push(handler);\n } else if (handler instanceof ModalHandler) {\n // Check for duplicate prefixes\n const existing = this.modalHandlers.find((h) => h.prefix === handler.prefix);\n if (existing) {\n console.warn(`Modal handler with prefix \"${handler.prefix}\" already exists. Overwriting.`);\n this.modalHandlers = this.modalHandlers.filter((h) => h.prefix !== handler.prefix);\n }\n this.modalHandlers.push(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 UserCommandInteraction(api, interaction as any, ctx);\n case ApplicationCommandType.Message:\n return new MessageCommandInteraction(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 UserCommandInteraction);\n } else if (interaction.data.type === ApplicationCommandType.Message) {\n await handler.execute(interactionObj as MessageCommandInteraction);\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 // Find matching handler by prefix\n const handler = this.componentHandlers.find((h) => h.matches(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 // Find matching handler by prefix\n const handler = this.modalHandlers.find((h) => h.matches(customId));\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 * It is important, that\n *\n * @example\n * ```typescript\n * import { Hono } from \"hono\";\n * import { HonoCord } from \"honocord\";\n *\n * const app = new Hono();\n * const honoCord = new Honocord();\n *\n * app.post(\"/interactions\", honoCord.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,OAAO,QAAQ,aAAa,GAAG,EAAE,CAAC;AAEnF,UAAO;KACN,EAAE,CAAmD;AAGxD,MAAI,KAAK,gBAAgB,IAAI,SAAS,6BAA6B,iBAAiB;AAClF,QAAK,SAAS,KAAK,gBAAgB,GAAG;AACtC,QAAK,kBAAkB,KAAK,gBAAgB,GAAG,WAAW,EAAE;;AAI9D,MAAI,KAAK,gBAAgB,IAAI,SAAS,6BAA6B,YAAY;AAC7E,QAAK,cAAc,KAAK,gBAAgB,GAAG;AAC3C,QAAK,kBAAkB,KAAK,gBAAgB,GAAG,WAAW,EAAE;;;CAIhE,IAAW,OAAO;AAChB,SAAO,KAAK;;;;;;;;;;CAWd,IAA4C,MAAc,MAAS,WAAW,OAAO;EACnF,MAAM,SAAS,KAAK,gBAAgB,MAAM,QAAQ,IAAI,SAAS,KAAK;AACpE,MAAI,CAAC,QAAQ;AACX,OAAI,SACF,OAAM,IAAI,UAAU,oBAAoB,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;AAG9D,UAAO;;AAGT,MAAI,OAAO,SAAS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,SAAS,OAAO,MAA8B;EAE5C,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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "honocord",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"module": "./dist/index.mjs",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
"hono",
|
|
19
19
|
"discord",
|
|
20
20
|
"cloudflare-workers",
|
|
21
|
+
"honocord",
|
|
21
22
|
"interactions"
|
|
22
23
|
],
|
|
23
24
|
"author": "Your Name",
|
|
@@ -30,7 +31,6 @@
|
|
|
30
31
|
"@discordjs/core": "^2.4.0",
|
|
31
32
|
"@discordjs/rest": "^2.6.0",
|
|
32
33
|
"discord-api-types": "^0.38.37",
|
|
33
|
-
"discord-interactions": "^4.4.0",
|
|
34
34
|
"hono": "^4.11.3"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|