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(ShardClientUtil): logic de-duplication #9491

Merged

Conversation

almeidx
Copy link
Member

@almeidx almeidx commented May 1, 2023

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

馃 Generated by Copilot at 4b576b6

Summary

馃殮馃敡馃Ч

This pull request refactors the sharding logic of discord.js to use a common function calculateShardId from the @discordjs/sharding package, which improves code quality and maintainability. It also moves the function definition from the util package to the sharding package, which reduces the API surface and the risk of breaking changes.

Oh we're the coders of the discord.js crew
And we like to keep our code tidy and true
So we moved the calculateShardId to the sharding pack
And we refactored the logic with a simple hack

Walkthrough

  • Move calculateShardId function from util to sharding package (link)
  • Import calculateShardId function from @discordjs/sharding in ShardClientUtil.js (link)
  • Replace inline shard id calculation with calculateShardId function call in ShardClientUtil.js (link)

Status and versioning classification:

  • Code changes have been tested against the Discord API, or there are no code changes

added docs to the `calculateShardId` function
@vercel
Copy link

vercel bot commented May 1, 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 1, 2023 8:02pm
discord-js-guide 猬滐笍 Ignored (Inspect) May 1, 2023 8:02pm

@kodiakhq kodiakhq bot merged commit a9f2bff into discordjs:main May 1, 2023
7 checks passed
@almeidx almeidx deleted the discord.js/shard-client-util-get-shard-id branch May 1, 2023 20:11
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

4 participants