Skip to content

fix(core): webhook delete query type, removeMember await#11483

Draft
almeidx wants to merge 1 commit intomainfrom
fix/core-misc
Draft

fix(core): webhook delete query type, removeMember await#11483
almeidx wants to merge 1 commit intomainfrom
fix/core-misc

Conversation

@almeidx
Copy link
Copy Markdown
Member

@almeidx almeidx commented Apr 5, 2026

@almeidx almeidx requested a review from a team as a code owner April 5, 2026 21:33
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 5, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Actions Updated (UTC)
discord-js Skipped Skipped Apr 5, 2026 9:33pm
discord-js-guide Skipped Skipped Apr 5, 2026 9:33pm

Request Review

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 5, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: cda15213-e3fe-4165-98a0-f50f0a731a54

📥 Commits

Reviewing files that changed from the base of the PR and between 1f9affd and 943dc19.

📒 Files selected for processing (2)
  • packages/core/src/api/guild.ts
  • packages/core/src/api/webhook.ts
📜 Recent review details
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: almeidx
Repo: discordjs/discord.js PR: 11471
File: packages/discord.js/src/util/Util.js:83-86
Timestamp: 2026-03-30T11:04:41.059Z
Learning: In discord.js (packages/discord.js and packages/rest), the `api` base URL and `version` string are used with raw interpolation (e.g. `${api}/v${version}${route}`) without normalization such as trailing slash trimming or stripping a leading "v". This is the established convention across the codebase (see REST.ts resolveRequest and fetchRecommendedShardCount in Util.js). Do not suggest normalizing these values.
🪛 GitHub Actions: Tests
packages/core/src/api/guild.ts

[error] Command failed: pnpm exec turbo run build --filter="...[origin/main]" --concurrency=4 (step @discordjs/core:build).

packages/core/src/api/webhook.ts

[error] 19-19: TypeScript build failed (TS2724): "discord-api-types/v10" has no exported member named 'RESTDeleteAPIWebhookWithTokenMessageQuery'. Did you mean 'RESTGetAPIWebhookWithTokenMessageQuery'?


[error] Command failed: pnpm exec turbo run build --filter="...[origin/main]" --concurrency=4 (step @discordjs/core:build).

🔇 Additional comments (2)
packages/core/src/api/guild.ts (1)

1240-1240: Good consistency update for removeMember.

Line 1240 now matches the existing 204-delete pattern used across this API wrapper and correctly resolves as Promise<void>.

packages/core/src/api/webhook.ts (1)

19-19: Build blocker: RESTDeleteAPIWebhookWithTokenMessageQuery is not exported by discord-api-types/v10.

Lines 19 and 263 import and use a type that CI reports as missing (TS2724). The type either does not yet exist in any published discord-api-types version, or the project needs to upgrade to a version where it is available. Until resolved, revert to the inline type or upgrade the dependency.

Temporary unblocking patch (fallback to inline type)
 	type RESTPostAPIWebhookWithTokenSlackQuery,
 	type RESTPostAPIWebhookWithTokenWaitResult,
-	type RESTDeleteAPIWebhookWithTokenMessageQuery,
 	type Snowflake,
 } from 'discord-api-types/v10';
@@
 	public async deleteMessage(
 		id: Snowflake,
 		token: string,
 		messageId: Snowflake,
-		query: RESTDeleteAPIWebhookWithTokenMessageQuery = {},
+		query: { thread_id?: Snowflake } = {},
 		{ signal }: Pick<RequestData, 'signal'> = {},
 	) {

📝 Walkthrough

Walkthrough

The changes refine two API methods in the core package. The GuildsAPI.removeMember method now explicitly awaits its REST deletion call instead of returning the promise directly. The WebhooksAPI.deleteMessage method's query parameter was updated to use a dedicated type from discord-api-types instead of an inline structural type. Both changes are type and control flow refinements with no runtime logic alterations.

Changes

Cohort / File(s) Summary
Guild API Update
packages/core/src/api/guild.ts
Modified removeMember to explicitly await the REST deletion call instead of returning the promise directly.
Webhook API Type Refinement
packages/core/src/api/webhook.ts
Updated deleteMessage query parameter from inline structural type to RESTDeleteAPIWebhookWithTokenMessageQuery imported from discord-api-types/v10.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes both main changes: webhook delete query type update and removeMember await fix.
Description check ✅ Passed The description is directly related to the changeset, explaining the rationale for both modifications and noting an external dependency.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/core-misc

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@almeidx almeidx marked this pull request as draft April 5, 2026 21:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

1 participant