Handler
The Handler type is a union of all specific handler classes provided by Honocord. It is primarily used when passing handlers to the loadHandlers method of the Honocord class.
Definition
Section titled “Definition”export type Handler<Context extends BaseInteractionContext = BaseInteractionContext> = | SlashCommandHandler<Context> | ContextCommandHandler<Context, ContextCommandType.User, UserContextInteraction<Context>> | ContextCommandHandler<Context, ContextCommandType.Message, MessageContextInteraction<Context>> | ComponentHandler<Context, ComponentType.Button> | ComponentHandler<Context, ComponentType.StringSelect> | ComponentHandler<Context, ComponentType.UserSelect> | ComponentHandler<Context, ComponentType.RoleSelect> | ComponentHandler<Context, ComponentType.MentionableSelect> | ComponentHandler<Context, ComponentType.ChannelSelect> | ModalHandler<Context> | WebhookEventHandler<ApplicationWebhookEventType, boolean, Context["env"], Context["var"], any>;Description
Section titled “Description”This union ensures that only valid handler instances are passed to the bot. Each member of the union corresponds to a specific type of Discord interaction or webhook event:
- Slash Commands
- User context menus
- Message context menus
- Buttons
- Select Menus (String, User, Role, Mentionable, Channel)
- Modals
- Webhook Events (both standard and worker modes)
The WebhookEventHandler accepts a boolean parameter for worker mode (true for Cloudflare Workers, false for standard environments).
AnyHandler
Section titled “AnyHandler”AnyHandler is a helper type that allows handlers with any context extending BaseInteractionContext.
export type AnyHandler = Handler<any>;