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

feat(Client): AsyncIterator-returning method for fetching members #9771

Merged

Conversation

almeidx
Copy link
Member

@almeidx almeidx commented Aug 13, 2023

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

Not sure what to name the new method, open to suggestions

🤖 Generated by Copilot at 15465c6

Summary

✨♻️📚

Added a new way to fetch guild members data using an async iterator. Improved the existing method to use the new iterator. Changed packages/core/src/client.ts.

Sing, O Muse, of the skillful Client who devised
A new way to fetch the members of many guilds
With an async iterator, a wondrous tool
Like the golden fleece that Jason sought with his crew

Walkthrough

  • Add requestGuildMembersIterator method to Client class to return an async iterator for guild members data (link, link)
  • Refactor requestGuildMembers method to use requestGuildMembersIterator internally and collect the data into a promise (link)
  • Import on and clearTimeout functions from node:events and node:timers modules for requestGuildMembersIterator (link)

Status and versioning classification:

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

@almeidx almeidx requested a review from a team as a code owner August 13, 2023 15:06
@vercel
Copy link

vercel bot commented Aug 13, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
discord-js ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 8, 2023 11:06am
discord-js-guide ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 8, 2023 11:06am

@github-actions
Copy link

github-actions bot commented Aug 13, 2023

⚡️ Lighthouse report for the changes in this PR:

Category Score
🟠 Performance 83
🟢 Accessibility 96
🟢 Best practices 100
🟠 SEO 73
🔴 PWA 33

Lighthouse ran on https://discord-js-guide-git-fork-almeidx-core-request-2a2622-discordjs.vercel.app/

@github-actions

This comment was marked as duplicate.

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.

We should also change the tsdoc for requestGuildMembersIterator to clarify it's a method that returns batches, preferably with an @example as well.

packages/core/src/client.ts Outdated Show resolved Hide resolved
packages/core/src/client.ts Outdated Show resolved Hide resolved
@almeidx almeidx force-pushed the core/request-guild-members-iterator branch 2 times, most recently from ed7b955 to c143250 Compare August 16, 2023 16:39
@almeidx almeidx requested a review from kyranet August 16, 2023 16:47
packages/core/src/client.ts Show resolved Hide resolved
packages/core/src/client.ts Show resolved Hide resolved
@almeidx almeidx force-pushed the core/request-guild-members-iterator branch from c143250 to 66e733c Compare August 19, 2023 12:11
packages/core/src/client.ts Outdated Show resolved Hide resolved
packages/core/src/client.ts Show resolved Hide resolved
@almeidx almeidx requested review from a team as code owners September 24, 2023 00:44
@almeidx almeidx requested review from a team and removed request for a team, monbrey, almostSouji, iCrawl, SpaceEEC, didinele, Jiralite, suneettipirneni and ckohen September 24, 2023 01:00
@almeidx almeidx dismissed stale reviews from vladfrangu and kyranet November 7, 2023 18:34

Stale

@kodiakhq kodiakhq bot merged commit fffe70a into discordjs:main Nov 8, 2023
5 of 6 checks passed
@almeidx almeidx deleted the core/request-guild-members-iterator branch November 8, 2023 11:02
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.

/core: add an AsyncIterator-returning method for fetching members
5 participants