Skip to content

Conversation

ckohen
Copy link
Member

@ckohen ckohen commented Sep 1, 2025

Please describe the changes this PR makes and why it should be merged:

Changes how channel edits are handled to allow sublimits to be handled properly within /rest.
Byproduct is channel editing is much more robust, allows raw api data, and can edit uncached channels now.

Supercedes #11000

Status and versioning classification:

  • Code changes have been tested against the Discord API, or there are no code changes
  • I know how to update typings and have done so, or typings don't need updating

Copy link

vercel bot commented Sep 1, 2025

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

2 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
discord-js Ignored Ignored Preview Oct 12, 2025 8:24pm
discord-js-guide Ignored Ignored Preview Oct 12, 2025 8:24pm

Copy link
Member

@SpaceEEC SpaceEEC left a comment

Choose a reason for hiding this comment

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

I don't know whether I like the setters in the object, but I suppose it works for this use-case here.

@Jiralite Jiralite added this to the discord.js 15.0.0 milestone Sep 2, 2025
Copy link
Member

@kyranet kyranet left a comment

Choose a reason for hiding this comment

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

Aside from @SpaceEEC's comment, the rest looks good to me

@github-project-automation github-project-automation bot moved this from Todo to Review Approved in discord.js Sep 4, 2025
@Jiralite Jiralite self-requested a review September 5, 2025 19:34
);
}

if (snakeCaseBody.default_reaction_emoji?.id) {
Copy link
Member

Choose a reason for hiding this comment

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

Any reason for checking id specifically here? Passing name wouldn't work this way.

Suggested change
if (snakeCaseBody.default_reaction_emoji?.id) {
if (snakeCaseBody.default_reaction_emoji) {

If there is a reason for the id check then we must also check for name.

Copy link
Member

Choose a reason for hiding this comment

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

sorry, I could be completely off base here since I haven't read everything/the types, but wouldn't your diff cause trouble if {} was passed?

Copy link
Member Author

Choose a reason for hiding this comment

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

good callout, I forgot emoji's can be name only. I'll add || name to it.

and @didinele no, {} would pass through in the body. Though speaking of types, I didn't add a | RESTPatchAPIChannelJSONBody to the types for this method, but I theoretically could at this point....should I?

Copy link
Member

Choose a reason for hiding this comment

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

Is that the direction we foresee the discord.js library going in (i.e., allowing passing raw payloads everywhere appropriate)?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think we should allow it (to better support new features that don't have real support yet), but I don't know that we should actually document it that way. It might be something we mention somewhere once, but I don't think we should specifically call it out except maybe types...my opinion will probably change once the lib is actually ts native and the underlying support for raw data is way better.

@github-project-automation github-project-automation bot moved this from Review Approved to Review in Progress in discord.js Sep 5, 2025
@ckohen ckohen force-pushed the refactor/channel-edit branch from ce45fd2 to 077462f Compare October 12, 2025 20:24
toSnakeCase(options),
);

// This overwrites a passed snake_case version if a camelCase version OR `parent` is passed
Copy link
Member

Choose a reason for hiding this comment

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

BTW, seems that in toSnakeCase(), if there are conflicting keys, the last one (by key order) takes precedence. i.e., if both snake case and camel case versions of a key are passed, the later one overwrites the earlier.
This won't be the case for these ones, where camel case will take precedence. Not sure if we should do something about it (maybe tweaking toSnakeCase to prefer the camel case version?..) or just let it be

Copy link
Member Author

Choose a reason for hiding this comment

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

I think I had set a precedent somewhere to prefer camel case when passsed which is why I did it this way.

I'm not exactly sure if I want to change that function in this PR, but I think it would make sense to because it would be more deterministic that way.

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

Projects

Status: Review in Progress

Development

Successfully merging this pull request may close these issues.

7 participants