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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(GuildMemberManager): Ensure empty object for fetching many guild members #10796

Merged
merged 1 commit into from
Mar 7, 2025

Conversation

Jiralite
Copy link
Member

@Jiralite Jiralite commented Mar 7, 2025

Please describe the changes this PR makes and why it should be merged:
A regression from #10715: when doing fetch(), an error is thrown:

/Users/jiralite/Documents/GitHub/discord.js/discord.js/packages/discord.js/src/managers/GuildMemberManager.js:220
    limit = 0,
    ^

TypeError: Cannot read properties of undefined (reading 'limit')
    at GuildMemberManager._fetchMany (/Users/jiralite/Documents/GitHub/discord.js/discord.js/packages/discord.js/src/managers/GuildMemberManager.js:220:5)
    at GuildMemberManager.fetch (/Users/jiralite/Documents/GitHub/discord.js/discord.js/packages/discord.js/src/managers/GuildMemberManager.js:201:31)
    at Client.<anonymous> (/Users/jiralite/Documents/GitHub/Soulobby/Soulobby/source/test.ts:11:58)
    at Client.emit (/Users/jiralite/Documents/GitHub/discord.js/discord.js/node_modules/.pnpm/@[email protected]/node_modules/@vladfrangu/async_event_emitter/src/index.ts:513:28)
    at Client._triggerClientReady (/Users/jiralite/Documents/GitHub/discord.js/discord.js/packages/discord.js/src/client/Client.js:389:10)
    at Client._checkReady (/Users/jiralite/Documents/GitHub/discord.js/discord.js/packages/discord.js/src/client/Client.js:283:12)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)

This is because the empty object default was removed, and as such, properties were attempted to be extracted from undefined.

This pull request adds the empty object back in.

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 Mar 7, 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) Mar 7, 2025 10:19am
discord-js-guide ⬜️ Ignored (Inspect) Mar 7, 2025 10:19am

@kodiakhq kodiakhq bot merged commit c78407e into main Mar 7, 2025
10 checks passed
@kodiakhq kodiakhq bot deleted the fix/guild-member-manager-optional-crash branch March 7, 2025 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

5 participants