Wrong guild.memberCount?

Hi, There's any reason why in a 9k users server this, sometimes, return a completely wrong user count?
// discord.js ^14.14.1
module.exports = {
event: 'guildMemberAdd',
run: async (client, member) => {
console.log('member.guild.memberCount);
// discord.js ^14.14.1
module.exports = {
event: 'guildMemberAdd',
run: async (client, member) => {
console.log('member.guild.memberCount);
I mean: it used to work fine for many months, but in last 2 days it started, sometimes, to return values like 1534 or similar ones, instead of 8-9k+. There's any known bug?
10 Replies
d.js toolkit
d.js toolkit12mo ago
- 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!
vizzielli
vizzielliOP12mo ago
(this the last logs, memberCount in yellow)
No description
mallusrgreat
mallusrgreat12mo ago
are you sure you filtered the guild?
vizzielli
vizzielliOP12mo ago
Uhm, do you mean it may come from a different server?
mallusrgreat
mallusrgreat12mo ago
yes
vizzielli
vizzielliOP12mo ago
It makes sense. It used to be in some unused servers, probably the best bet is to kick it from any server considering I want to use it now only in this one. There's a way to let the bot leave all servers but not the one I want (serving it the right server id)?
mallusrgreat
mallusrgreat12mo ago
filter the guilds.cache and use leave() on everything thats not a specific id
vizzielli
vizzielliOP12mo ago
Ye added now, but this should work to let it leave any server during time, not?
if (obj.guild.id !== 'my-server-id' {
obj.guild.leave();
}
if (obj.guild.id !== 'my-server-id' {
obj.guild.leave();
}
Thank you!
mallusrgreat
mallusrgreat12mo ago
yes also return as well
vizzielli
vizzielliOP12mo ago
👍👍 Just for archive purpose, instead to wait for some event, i run this once:
console.log(client.guilds.cache.map(guild => guild.id));
console.log(client.guilds.cache.map(guild => guild.id));
Than use this for any old server to leave:
client.guilds.cache.get('here-guild-to-leave-id').leave();
client.guilds.cache.get('here-guild-to-leave-id').leave();
Thanks again.

Did you find this page helpful?