Skip to content

Conversation

@almeidx
Copy link
Member

@almeidx almeidx commented Dec 9, 2025

Integrates the new endpoint into the RoleManager

Upstream:

Copilot AI review requested due to automatic review settings December 9, 2025 21:30
@almeidx almeidx requested a review from a team as a code owner December 9, 2025 21:30
@vercel
Copy link

vercel bot commented Dec 9, 2025

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

2 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
discord-js Skipped Skipped Dec 11, 2025 9:10am
discord-js-guide Skipped Skipped Dec 11, 2025 9:10am

@coderabbitai
Copy link

coderabbitai bot commented Dec 9, 2025

📝 Walkthrough

Walkthrough

Adds a new public method fetchMemberCounts() to the RoleManager class that fetches per-role member counts via a REST API call and returns a Collection mapping role IDs to member counts.

Changes

Cohort / File(s) Change Summary
RoleManager fetchMemberCounts method
packages/discord.js/src/managers/RoleManager.js, packages/discord.js/typings/index.d.ts
Added new public async method fetchMemberCounts() that calls REST endpoint Routes.guildRoleMemberCounts(this.guild.id) and returns a Collection of role ID to member count pairs; includes JSDoc documentation noting @everyone role is excluded

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • Verify the REST endpoint path and guild ID parameter are correct
  • Confirm Collection construction from API response data matches expected format
  • Review JSDoc accuracy regarding @everyone exclusion and return type documentation

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: adding a new fetchMemberCounts method to RoleManager.
Description check ✅ Passed The description is related to the changeset, explaining that the PR integrates a new endpoint and references the upstream API change.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/guild-role-member-counts

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 548d752 and 808b450.

📒 Files selected for processing (2)
  • packages/discord.js/src/managers/RoleManager.js (1 hunks)
  • packages/discord.js/typings/index.d.ts (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
packages/discord.js/typings/index.d.ts (1)
packages/collection/src/collection.ts (2)
  • Collection (12-19)
  • Collection (29-1107)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Agent
  • GitHub Check: Tests
🔇 Additional comments (2)
packages/discord.js/typings/index.d.ts (1)

4701-4711: RoleManager typings match runtime API

fetchMemberCounts(): Promise<Collection<Snowflake, number>> correctly reflects the new method’s runtime behavior and placement alongside the existing fetch overloads is consistent. No issues from a typing/API-surface perspective.

packages/discord.js/src/managers/RoleManager.js (1)

84-93: Implementation of fetchMemberCounts is consistent and straightforward

The method cleanly wraps the member-counts REST endpoint and returns a Collection keyed by role ID with count values, matching the new typings and JSDoc description (including the documented exclusion of @everyone). No correctness or integration issues spotted.


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

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR integrates a new Discord API endpoint into the RoleManager class by adding a fetchMemberCounts() method that retrieves the number of members for each role in a guild. This implementation follows the upstream Discord API documentation update (PR #8025).

Key Changes

  • Added fetchMemberCounts() method to fetch role member counts from the Discord API
  • TypeScript type definitions updated to include the new method signature

Reviewed changes

Copilot reviewed 1 out of 2 changed files in this pull request and generated 1 comment.

File Description
packages/discord.js/typings/index.d.ts Added TypeScript type definition for the new fetchMemberCounts() method returning a Promise of a Collection mapping Snowflake role IDs to numbers
packages/discord.js/src/managers/RoleManager.js Implemented fetchMemberCounts() method that calls the new Discord API endpoint and transforms the response into a Collection

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

This comment was marked as outdated.

@github-project-automation github-project-automation bot moved this from Todo to Review in Progress in discord.js Dec 11, 2025
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
@vercel vercel bot temporarily deployed to Preview – discord-js-guide December 11, 2025 09:10 Inactive
@vercel vercel bot temporarily deployed to Preview – discord-js December 11, 2025 09:10 Inactive
@almeidx almeidx removed the blocked label Dec 11, 2025
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.

6 participants