Migrate to shared discord-bot-framework registries and dispatch#168
Open
WentTheFox wants to merge 2 commits into
Open
Migrate to shared discord-bot-framework registries and dispatch#168WentTheFox wants to merge 2 commits into
WentTheFox wants to merge 2 commits into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
const enums, aggregator maps, and dispatch handlers with@wentthefox-org/discord-bot-framework's typed registries (createChatInputCommandRegistry,createContextMenuCommandRegistry,createComponentRegistry) anddispatch*functions.src/utils/get-application-commands.tsis replaced by the framework'sbuildApplicationCommandsBody(called fromupdate-guild-commands.ts).handle-*-interaction.tsfiles collapse into one newsrc/utils/build-user-interaction-context.ts, andsrc/utils/client.ts'sonInteractionnow callsdispatchChatInputCommand/dispatchAutocomplete/dispatchComponent/dispatchContextMenudirectly (kept as direct calls rather thancreateInteractionRouterso the existing post-handle telemetry hook still runs).messaging.ts's hand-rolledgetCustomIdSegmentsis removed in favor of the framework'sparseCustomIdSegments, used internally bydispatchComponent.@wentthefox-org/discord-bot-frameworkto^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 lintpassespnpm run buildpasses (generate-faq + tsc)pnpm test runpasses (78 tests, 11 files)/atautocomplete, a context-menu command, a proposal approve/reject component, the unexpected-error path, telemetry) — not performed in this session, recommended before mergeCo-Authored-By: Claude Sonnet 5 noreply@anthropic.com