Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(GuildChannel): simplify constructor #9499

Conversation

kyranet
Copy link
Member

@kyranet kyranet commented May 2, 2023

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

  • this.parentId = this.parentId ?? null was an useless call since this.parentId is undefined at construct (as the parent class doesn't assign it either), therefore the check was moved to the _patch method with a default, consistent with the rest of structures.
  • guild?.client is an unnecessary check when client is already passed and always guaranteed to exist. Removing this check allows us to reduce some overhead when creating channels.

馃 Generated by Copilot at 6a83a0f

Oh we're the coders of the sea, and we like to keep things neat
We simplify the GuildChannel class, and make the parentId complete
We use the nullish operators, to avoid the extra work
And when we're done we push the code, and give ourselves a smirk

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

@kyranet kyranet requested a review from a team as a code owner May 2, 2023 09:38
@vercel
Copy link

vercel bot commented May 2, 2023

The latest updates on your projects. Learn more about Vercel for Git 鈫楋笌

2 Ignored Deployments
Name Status Preview Comments Updated (UTC)
discord-js 猬滐笍 Ignored (Inspect) May 2, 2023 9:38am
discord-js-guide 猬滐笍 Ignored (Inspect) May 2, 2023 9:38am

@kodiakhq kodiakhq bot merged commit f2ad076 into discordjs:main May 2, 2023
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

5 participants