Skip to content

@bight-ts/core — Interactions

import {
defineButtonHandler,
defineModalHandler,
defineSelectMenuHandler,
} from "@bight-ts/core";

All three handler types share the same structure — they differ only in the interaction type passed to execute.

PropertyTypeRequiredDescription
customIdstringOne of customId or customIdPrefixExact custom ID match
customIdPrefixstringOne of customId or customIdPrefixPrefix-based match for dynamic custom IDs
execute(input: { interaction: ButtonInteraction, context }) => voidYesThe button handler
preconditionsstring[]NoNamed preconditions
onDeniedBightDeniedHandlerNoCustom denial handler
PropertyTypeRequiredDescription
customIdstringOne of customId or customIdPrefixExact custom ID match
customIdPrefixstringOne of customId or customIdPrefixPrefix-based match
execute(input: { interaction: ModalSubmitInteraction, context }) => voidYesThe modal handler
preconditionsstring[]NoNamed preconditions
onDeniedBightDeniedHandlerNoCustom denial handler
PropertyTypeRequiredDescription
customIdstringOne of customId or customIdPrefixExact custom ID match
customIdPrefixstringOne of customId or customIdPrefixPrefix-based match
execute(input: { interaction: StringSelectMenuInteraction, context }) => voidYesThe select menu handler
preconditionsstring[]NoNamed preconditions
onDeniedBightDeniedHandlerNoCustom denial handler

RoutedInteractionExecution<TInteraction, TServices>

Section titled “RoutedInteractionExecution<TInteraction, TServices>”

Passed to all handler execute functions.

PropertyTypeDescription
interactionTInteractionThe Discord interaction (ButtonInteraction, ModalSubmitInteraction, or StringSelectMenuInteraction)
contextBightContext<TServices>Your app context
  • Exact match (customId): The handler fires only when the interaction’s custom ID matches exactly.
  • Prefix match (customIdPrefix): The handler fires for any custom ID that starts with the prefix. Use with Custom IDs for dynamic data.
  • Global preconditions apply to all routed interactions.
  • Errors are recorded as interaction_error events in diagnostics.