Skip to content

Migrate to shared discord-bot-framework registries and dispatch#168

Open
WentTheFox wants to merge 2 commits into
mainfrom
migrate-discord-bot-framework
Open

Migrate to shared discord-bot-framework registries and dispatch#168
WentTheFox wants to merge 2 commits into
mainfrom
migrate-discord-bot-framework

Conversation

@WentTheFox

Copy link
Copy Markdown
Owner

Summary

  • Replace hand-rolled command/component/context-menu const enums, aggregator maps, and dispatch handlers with @wentthefox-org/discord-bot-framework's typed registries (createChatInputCommandRegistry, createContextMenuCommandRegistry, createComponentRegistry) and dispatch* functions.
  • src/utils/get-application-commands.ts is replaced by the framework's buildApplicationCommandsBody (called from update-guild-commands.ts).
  • The four handle-*-interaction.ts files collapse into one new src/utils/build-user-interaction-context.ts, and src/utils/client.ts's onInteraction now calls dispatchChatInputCommand/dispatchAutocomplete/dispatchComponent/dispatchContextMenu directly (kept as direct calls rather than createInteractionRouter so the existing post-handle telemetry hook still runs).
  • messaging.ts's hand-rolled getCustomIdSegments is removed in favor of the framework's parseCustomIdSegments, used internally by dispatchComponent.
  • Bumped @wentthefox-org/discord-bot-framework to ^0.2.4, which included several framework-side generic-inference fixes (published as part of this same effort) required for HammerTimeBot's enum-keyed, TFunction-typed registries to typecheck correctly.

Test plan

  • pnpm run lint passes
  • pnpm run build passes (generate-faq + tsc)
  • pnpm test run passes (78 tests, 11 files)
  • Manual verification against a live Discord bot (register commands, /at autocomplete, a context-menu command, a proposal approve/reject component, the unexpected-error path, telemetry) — not performed in this session, recommended before merge

Co-Authored-By: Claude Sonnet 5 noreply@anthropic.com

WentTheFox and others added 2 commits July 13, 2026 00:21
Replaces hand-rolled command/component/context-menu enums, aggregator
maps, and dispatch handlers with @wentthefox-org/discord-bot-framework's
typed registries (createChatInputCommandRegistry, createComponentRegistry,
createContextMenuCommandRegistry) and dispatch* functions, so command/
component files only need to supply data instead of wiring boilerplate.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Adds a DISCORD_LOG_WEBHOOK_URL env var so warn/error logs can fan out
to a Discord webhook alongside the console, using the framework's new
createLogger() transport-based logger.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant