-
-
Notifications
You must be signed in to change notification settings - Fork 6
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
Use Guild member counts rather than user cache size #182
Conversation
Hi, thanks for the PR! Anyway, regarding your contribution: the change looks good to me. The tests for |
This change should be mirrored to the other client fillers if possible. I'm pretty sure the other client fillers rely on user cache rather than member count. |
Codecov Report
@@ Coverage Diff @@
## master #182 +/- ##
==========================================
- Coverage 96.98% 96.42% -0.57%
==========================================
Files 45 45
Lines 1196 1204 +8
Branches 191 191
==========================================
+ Hits 1160 1161 +1
- Misses 32 39 +7
Partials 4 4
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Snazzah Maybe it's better if we merge this PR and change only discord.js for now.
Then we can always change the other ones too, but maybe it's better if you do it, I'm not really that familiar with the other libraries.
Guild#memberCount
instead of relying on User collection size
This looks great! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome!
Co-authored-by: Federico Grandi <[email protected]>
@Lioness100 All set then! Thanks again for your contribution! The fix will be published in the next version 👍🏻 |
This is mostly a fix for discord.js v12+
Currently,
DiscordJS#userCount
relies on the user cache, which will result in inaccurate numbers. (Much) more often than not, the user cache will not include every single user. Instead, it would be better to use the guild cache (since by default they're all guaranteed to be there) usingCollection#reduce()
andGuild#memberCount