Repository navigation
Simplify Discord routing, provider handling and AI replies - #63
Merged
Merged
Conversation
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.
Discord interactions and gateway events now route with match, and authenticated Discord payloads use documented wire fields directly. Removes redundant conversion and validation helpers, repeated shape checks, speculative fallback chains, and the single-use reply callback. AI requests and provider outputs use explicit formats with one fresh D1 settings snapshot per request.
Signature verification decodes hex directly while retaining fail-closed authentication, exact signed body bytes, and the five-minute timestamp window. AI replies preserve model text, IDs and formatting; allowed_mentions prevents pings and Discord's SUPPRESS_EMBEDS flag suppresses link previews. Reply length limits and empty-response fallback remain. Permissions, gateway lifecycle, Discord rate limits and bounded media streaming are preserved.
Validation: pnpm run check; pnpm test (116 passed); pnpm run test:runtime; production deployment dry run. GitHub Actions passed for commit 6d1def4. No schema, binding or command-registration changes.
Deployed production Worker version db2ef787-8419-4a23-a193-e97101d69843. The Cloudflare plugin confirmed 100% traffic. Live checks confirmed bare 401 responses for unsigned interactions and unauthenticated controls. The gateway was restarted after rollout and authenticated health confirms connected and resumable.