Skip to content

chore(discord): update discord-api-types to 0.38 and dedupe types - #927

Merged
bensabic merged 4 commits into
vercel:mainfrom
vladfrangu:chore/bump-discord-api-types
Sep 18, 2026
Merged

bensabic merged 4 commits into
vercel:mainfrom
vladfrangu:chore/bump-discord-api-types

Conversation

@vladfrangu

Copy link
Copy Markdown
Contributor

Summary

Bumps discord-api-types to ^0.38.55 in @chat-adapter/discord and @chat-adapter/integration-tests (dedupes the copy discord.js already pulls in) and replaces the adapter's hand-written Discord types with the upstream ones. types.ts now only holds adapter config and the Gateway forwarding envelope.

  • Public API unchanged: DiscordComponentType and DiscordMessageFlag re-export ComponentType and MessageFlags with identical values.
  • Fixes forwarded reactions in threads and DMs: the forwarder now sets channel_type and, when there is no member, user. The webhook side read both but nothing populated them.
  • Cleans up the deprecated v9 import and GuildPublicThread aliases, raw 11/12 channel comparisons, the unused is_mention field, and the duplicate InteractionResponseType from discord-interactions.

I have done this PR with the help of Claude Code using Fable 5.1, however the changes have been checked by me (the human). I have thoughts on some of the structures but I understand that you guys want to offer a consistent interface across different adapters.

There's also a secondary PR I want to open that moves off of raw fetch calls to discord and use @discordjs/rest (which discord.js uses internally) but I'll wait for this PR first. I can open it in parallel if wanted

Test plan

  • pnpm validate passes.
  • 294 adapter tests and 66 Discord replay/integration tests pass. Three legacy-gateway test fakes gained the fields real discord.js interactions always carry.

Checklist

  • All commits are signed and verified
  • All commits are signed off for the DCO (git commit -s)
  • pnpm validate passes
  • Changeset added (or N/A — see CONTRIBUTING.md)
  • Documentation updated (or N/A) — no user-facing behavior or config changed; adapter AGENTS.md updated to point at discord-api-types

Signed-off-by: Vlad Frangu <me@vladfrangu.dev>
…i-types

Signed-off-by: Vlad Frangu <me@vladfrangu.dev>
@vladfrangu
vladfrangu requested a review from a team as a code owner September 12, 2026 16:12
@vercel

vercel Bot commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

@vladfrangu is attempting to deploy a commit to the Vercel Team on Vercel.

A member of the Team first needs to authorize it.

@socket-security

socket-security Bot commented Sep 12, 2026 •

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatednpm/​discord-api-types@​0.38.37 ⏵ 0.38.55100 +1100100 +198 +1100

View full report

vladfrangu and others added 2 commits September 12, 2026 18:15
Signed-off-by: Vlad Frangu <me@vladfrangu.dev>
…ng after the type swap

- Return `channel: undefined` for legacy Gateway interactions in channels discord.js has not cached, instead of throwing before the reply is deferred
- Route context menu commands to `onSlashCommand` under their command name again
- Forward Gateway events for the same channel in arrival order so a quick reaction add then remove cannot race
- Forward `thread: { id, parent_id }` for reactions posted in threads and honor it on the webhook side, skipping the second channel lookup
- Log failed channel and user lookups during reaction enrichment at warn
- Share one helper for interaction thread id encoding and thread parent caching
- Restore `DiscordComponentType` and `DiscordMessageFlag` as plain `as const` objects with values sourced from discord-api-types
- Widen `DiscordInteractionFlagsContext.interaction` to `APIApplicationCommandInteraction`
- Add `sample-messages.md` with payloads taken from the Discord replay fixture
- Add tests for each of the above and update the changeset

Signed-off-by: Ben Sabic <bensabic@users.noreply.github.com>
@bensabic
bensabic merged commit 61b98fc into vercel:main Sep 18, 2026
13 of 15 checks passed
@vladfrangu

Copy link
Copy Markdown
Contributor Author

Any reason you peeps duplicated certain enums again? Why not reexport from discord-api-types?

amitvijapur added a commit to amitvijapur/chat that referenced this pull request Sep 20, 2026
…acket-snapshot

Forwarding moved behind enqueueOrderedForward on main (vercel#946, vercel#927), which
defers the task a microtask even on an empty queue, so the snapshot now
happens in the raw handler before the enqueue and the clone is what gets
forwarded.
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.

2 participants