Repository navigation
feat: add gateway webhooks - #106
Conversation
◈ PR LensPR Lens paused analysis for this repository — the fair-use limit was reached. It resumes automatically at 2026-09-25T18:00:00.000Z. |
@wolfstar/plugin-api
@wolfstar/plugin-cache
@wolfstar/plugin-gateway
@wolfstar/plugin-i18next
@wolfstar/plugin-logger
@wolfstar/plugin-subcommands-advanced
commit: |
There was a problem hiding this comment.
✅ No blocking issues found.
Reviewed changes
Reviewed the full diff of feat/webhooks (base feat/channels): a new Webhook structure, WebhookManager (client.webhooks), a ChannelWebhooksMixin applied to the six channel types that support webhooks, Guild#fetchWebhooks, AnnouncementChannel#addFollower, and the accompanying tests/docs/changeset.
Webhookstructure — discord.js-parity fields (isIncoming/isChannelFollower/isApplicationCreated,url,avatarURL) plussend/edit/delete/fetchMessage/editMessage/deleteMessage, following the codebase's establishedthis[kPatch](x.toJSON())edit pattern.WebhookManager— deliberately not aCachedManager(webhooks aren't cached, since the gateway only signalswebhooksUpdate). Token-authenticated calls correctly skip bot authorization (auth: false), mirroring discord.js'sWebhookClient.send/fetchMessage/editMessageroute throughMessageManager._add, which already skips caching a webhook's author as a user.ChannelWebhooksMixin—fetchWebhooks/createWebhookon text, announcement, voice, stage, forum, and media channels, matching which channel types actually expose the webhook routes on Discord's side.Guild#fetchWebhooks,AnnouncementChannel#addFollower— straightforward REST wrappers;addFollower's return value matchesRESTPostAPIChannelFollowersResult'swebhook_idfield.
I traced the token vs. bot-auth branching between Webhook.edit()/delete() and WebhookManager's REST calls, the Routes.webhook/Routes.webhookMessage signatures, and the guild_id/channel_id/application_id nullability against discord-api-types' APIWebhook — all consistent with the PR description and Discord's actual API contracts. No correctness issues found.
ℹ️ Nitpicks
packages/plugin-gateway/tests/webhooks.test.tscovers create/fetch-channel, send+cache, edit (token vs. channel-move), the no-token throw,client.fetchWebhookwith a token, andaddFollower— but notWebhookManager.delete(),fetchMessage(),editMessage(),deleteMessage(), orGuild#fetchWebhooks(). Worth adding coverage for those before merge, since it's roughly half of the new public surface.WebhookManager.delete(webhookId, { token, reason })bundlestokeninside an options object, while siblingfetch(webhookId, token?)andedit(webhookId, options, token?)take it as a trailing positional parameter — a small inconsistency within the same file.Webhook#sourceGuild/sourceChannel(packages/plugin-gateway/src/structures/Webhook.ts) lack explicit return-type annotations, unlike every other getter in the file.
Claude Sonnet | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
The new commit (6d70ef2) is a merge of feat/channels into feat/webhooks bringing in 3 unrelated files (ChannelManager.ts, util/channels.ts, channels.test.ts — base-branch changes, not part of this PR's webhook surface). The webhook-related diff is byte-identical to what was already reviewed in the prior review; nothing new to evaluate here.
Claude Sonnet | 𝕏
6d70ef2 to
b018afa
Compare
b018afa to
58313e7
Compare
|
Your Claude subscription has hit its usage limit. It resets at 7:20pm (UTC). Re-trigger Pullfrog after the reset, or add an Add repo secret → · Model settings → · Setup docs → · Ask in Discord →
|
58313e7 to
089378e
Compare
|
Your Claude subscription has hit its usage limit. It resets at 7:20pm (UTC). Re-trigger Pullfrog after the reset, or add an Add repo secret → · Model settings → · Setup docs → · Ask in Discord →
|

Stacked on #105.
🔗 Linked issue
Related to #54 (phase 8b of the roadmap).
🧭 Context
There was no way to manage webhooks or post through one. The only webhook-related piece was the
webhooksUpdateevent.📚 Description
Webhooks follow discord.js:
Webhookhas every field,urlandavatarURL, theisIncoming/isChannelFollower/isApplicationCreatedchecks, andsend,edit,delete,fetchMessage,editMessageanddeleteMessage.client.webhooksis a newWebhookManagerbehind all of that, andclient.fetchWebhook(id, token?)matches discord.js.fetchWebhooksandcreateWebhookfrom a newChannelWebhooksMixin. Guilds getfetchWebhooks, and announcement channels getaddFollower.Choices worth a look:
auth: false), like discord.js'sWebhookClient, so they also work for other applications' webhooks.webhook.edituses the token when there is one, except to move the webhook to another channel. Discord only allows that with the bot's authorization.sendwaits for the message (?wait=true) and adds it throughclient.messages._add. It lands in the cache, and since it has awebhook_id, its author is not cached as a user (feat: resolve gateway structure relations through the cache with _add #102).threadIdtargets a thread of the webhook's channel (forum posts and threads).Key changes
Webhook;ChannelWebhooksMixinon six channel types;AnnouncementChannel#addFollower;Guild#fetchWebhooksWebhookManager(client.webhooks),client.fetchWebhookType of Change
Pre-flight Checklist
pnpm changeset(orpnpm changeset add --emptyif no release is needed). See .changeset/README.md.