Skip to content

fix: Channel Name ratelimit make channel.edit functions freeze #11000

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

ErdemGKSL
Copy link

Description of Changes and Justification:

This PR adjusts the request handler to avoid unnecessary sublimit blocking when editing a channel. Currently, editing a channel name three times triggers a sublimit rate limit. Following that, all subsequent channel.edit() calls (even ones not modifying the name) are queued behind the rate limit, which is incorrect.

This PR ensures that channel.edit() requests which do not modify the name field are not blocked by the name change sublimit. This improves compliance with Discord's rate-limiting behavior and prevents unrelated modifications (e.g., permissions, user limits, etc.) from being delayed.

Status and versioning classification:

  • Code changes have been tested against the Discord API
  • Typings don't need updating
  • This PR changes the library's interface: No
  • This PR includes breaking changes: No
  • This PR only includes non-code changes: No

@ErdemGKSL ErdemGKSL requested a review from a team as a code owner July 17, 2025 20:54
Copy link

vercel bot commented Jul 17, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
discord-js ⬜️ Ignored (Inspect) Visit Preview Jul 17, 2025 8:55pm
discord-js-guide ⬜️ Ignored (Inspect) Visit Preview Jul 17, 2025 8:55pm

@ckohen
Copy link
Member

ckohen commented Jul 18, 2025

This is working exactly as designed. the sublimitPromise only exists when a sublimited request is actively on the wire, which means we should not be sending another request. The real reason you encounter this is because disord.js always passes name and topic via that edit function (on the wire undefined goes away, but the body is checked before that, it might be worth considering checking if those properties are non-undefined, but I don't love that risk). See below

const newData = await this.client.rest.patch(Routes.channel(resolvedChannel.id), {
body: {
name: options.name,
type: options.type,
topic: options.topic,

@Qjuh
Copy link
Member

Qjuh commented Jul 18, 2025

So I guess the real fix would be to dynamically build the body in the edit method to only include those properties if they are present in options.

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.

3 participants