Stats command returning wrong member count after X hours
For the first hours, sometimes even a day it returns the correct member count, but sometimes randomly it starts returning the wrong member count.
Then if I restart the bot, it shows the correct count again.
Before restart:
Server Count: 34,726
Member Count: 21,783
After restart:
Server Count: 34,697
Member Count: 1,367,868
It has even said "Member Count: 0" before.
15 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Not a discord.js issue? Check out #other-js-ts.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!You can use guild.members.fetch() to refresh your cache.
You think it's a cache issue?
But doesn't it take kinda long to complete that fetch if there are like 1.3M members?
So what else could it be? Cause I have been clueless about it for really long 😅
if your shard disconnects it could desync
calm down Im just trying to provide some insight
That the total shards is the same as
responsiveShards
Well I can't check all 35 shards just like that
Well no one is, so I assume that all shards are responsive. But I can't know with a 100% certainty as users could technically just not report it
But if we go with if users reporting downtime, then all shards are responsive as no one reports itDo you mean replacing the
responsiveShards
with this then?(c.user, not client.user)
So replace it with this?
Righttt
So now 😅 Replace it with this?
Oh you're right... adding
.then
Shard Count: 35
Shards Online: 1
Why's only one shard showing as online?
Because results[2]
would be either "true" or "false"
It errors if I use filter tho
TypeError: results[2].filter is not a function
I do that inside the .then
? Before I reassign responsiveShards
Oooh, so
Ahh yeah, on my test bot it returned [ true ]
Good catch, thank you 😄
Looks correct on prod bot as well :))
Shard Count: 35
Shards Online: 35
I'll come back to this post when it gives the wrong member count again and be able to tell if a shard is offline
Server Count: 34,792
Member Count: 26,592
Shard Count: 35
Shards Online: 35
Ruling out offline shards
Could it be a caching issue? Do I need to client.members.fetch()
every 2 hours or something to keep the cache up to date? Or could it be something elseyou could add a check. if totalMembers drops significantly or returns unusually low (like 0), trigger a refetch for all shards to refresh member data.
Actually error logs do go to a separate file and there isn’t anything there
.log goes to my log file, .error goes to my error file 😅
Goes when I get errors, they go in my error file? I’m not sure what you’re asking 😅 I run my bot on a Linux server and use pm2, and there are 2 logging files, one for just logs and one for error logs. Console.error throws them in the error log file. And it’s been doing so correctly for many many months 😅
Uh I’m not sure. I wasn’t the one to set up the Linux server and pm2. But whenever I get an error, it always goes in the error file. Like whether it’s a TypeError, ReferenceError or a Discord error
Any ideas?
@Qjuh sorry for the ping but do you have any ideas for it?
I mean it's kinda common politeness to then say you don't instead of ignoring, but okay
I replied to your message 🤦♀️
Shut the friggle up
https://discord.com/channels/222078108977594368/222109930545610754/1130079512420433960 "Don't be a jerk" :)
Ty