Skip to content

fix(plugin-gateway): read the optional ids of a message as null like discord.js - #276

Merged
kodiakhq[bot] merged 1 commit into
mainfrom
fix/gateway-message-null-ids
Nov 2, 2026
Merged

kodiakhq[bot] merged 1 commit into
mainfrom
fix/gateway-message-null-ids

Conversation

@RedStar071

@RedStar071 RedStar071 commented Nov 2, 2026 •

Copy link
Copy Markdown
Member

🔗 Linked issue

Related to wolfstar-project/wolfstar#357

🧭 Context

The honeypot of Wolfstar caught nobody on staging. The bot skips webhooks with message.webhookId !== null, as it did with discord.js, but our Message inherits webhookId from @discordjs/structures, which gives undefined when there is no webhook. Every message read as a webhook's, so the bot ignored all of them since it moved to the gateway plugin.

📚 Description

Message already mirrors discord.js where it overrides a getter (guildId, editedTimestamp are null when absent), but webhookId, applicationId, nonce and position came straight from the base class. They are null now when the message has none, the same as in discord.js.

Not sure this is the full list: I only looked at the getters of Message that are not overridden. Other structures may inherit the same undefined from @discordjs/structures, I did not go through them.

Key changes

Getter Before (no value) After
Message#webhookId undefined null
Message#applicationId undefined null
Message#nonce undefined null
Message#position undefined null

The four keys are omitted from the type of the base class (BaseMessage<"webhook_id" | ...>), as MessageReaction does for its counts, since an override cannot narrow string | undefined to string | null.

Type of Change

  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation change
  • Workflow / CI change

Pre-flight Checklist

  • I have read the Contributing Guidelines (if applicable)
  • My code follows the code style of this project
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have updated the documentation accordingly
  • I added a changeset with pnpm changeset (or pnpm changeset add --empty if no release is needed). See .changeset/README.md.

🤖 AI disclosure: Claude Code (Wolfstar Agent Kit) was used on this PR. Code written with claude-opus-5-5; PR description written with claude-opus-5-5. AI policy.


Play the walkthrough

@coldtea-pr-lens

coldtea-pr-lens Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Architecture

Architecture diagram for wolfstar-project/plugins at 3a54787

Play the walkthrough


Data flow

No data-flow sequence changed in this PR.


Tip

The diagrams are links. Click one to open it on the canvas, then press W or click play to walk through the change

🪧 More tips
  • Run npx skills add coldteadotai/pr-lens, then tell your coding agent: "Diagram the change you just made with PR Lens and attach it to the pull request."
  • Run npx @coldtea/pr-lens-cli analyze --base origin/main on a branch, then npx @coldtea/pr-lens-cli render .pr-lens/graph.json. Same lenses, your own model key, before the pull request exists
  • Click the link under each diagram to open it on a canvas you can zoom, pan and step through
  • Open a diagram on the canvas, then press W or click play to walk through the change one step at a time
  • The CLI's render reads .github/pr-lens.yml and applies your renames, exclusions and lane pins at draw time
  • Set github.comment.collapsed: true in .github/pr-lens.yml to fold the comment behind one View architecture… row. Drawing still runs as before
  • Set github.draw: on-demand in .github/pr-lens.yml and PR Lens stops drawing pull requests on its own. Comment @pr-lens draw on a pull request when you want that one drawn
  • Add .github/workflows/pr-lens.yml with coldteadotai/pr-lens/packages/action@v0 and your model provider's key as its api-key to run PR Lens from your own CI. Any /chat/completions endpoint works
  • After a push, tick Redraw to draw the latest commit
  • Switch GitHub to dark mode and the diagrams follow. The moving dots are this pull request's data in motion
  • Set github.description: false in .github/pr-lens.yml to stop PR Lens adding buttons to your PR descriptions

Thanks for using PR Lens! It's free for OSS. If it helped, a star helps other teams find it.  Star PR Lens on GitHub

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes: the full diff of the single commit, with the structures test file run locally (24/24 pass).

  • Message getters — webhookId, applicationId, nonce and position now return ?? null, matching discord.js and the existing guildId/editedTimestamp overrides.
  • Base generic — NullableMessageKeys is omitted from BaseMessage<...>, which lets the overrides narrow string | undefined to string | null (the base getter is typed against Omitted, so this is the right lever).
  • Tests and changeset — covers both the absent case (null) and the present case, including position: 0 surviving as 0 rather than collapsing to null; patch changeset for @wolfstar/plugin-gateway.

pnpm typecheck reports errors in this checkout, but they come from @wolfstar/plugin-cache not being built here, and none sit on the new lines.

Pullfrog  | View workflow run | Using claude-sonnet-5-5 | 𝕏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

packages:plugin-gateway Changes in plugin-gateway

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants