Skip to content

Commit

Permalink
[Fix] looks like client.guilds.cache.size does not update after bot…
Browse files Browse the repository at this point in the history
… start, which makes it useless
  • Loading branch information
naseif committed Nov 27, 2021
1 parent 46d8f12 commit 92608a7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
10 changes: 4 additions & 6 deletions events/guildCreate.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,9 @@ module.exports = {
return;
}
await registerSlashCommands(guild.client.user.id, guild.id);
guild.client.user.setActivity(
`Music in ${client.guilds.cache.size} Servers!`,
{
type: "PLAYING",
}
);
const guilds = client.guilds.cache.map((guild) => guild.id);
client.user.setActivity(`Music in ${guilds.length} Servers!`, {
type: "PLAYING",
});
},
};
10 changes: 4 additions & 6 deletions events/guildDelete.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
module.exports = {
name: "guildDelete",
async execute(guild) {
guild.client.user.setActivity(
`Music in ${client.guilds.cache.size} Servers!`,
{
type: "PLAYING",
}
);
const guilds = client.guilds.cache.map((guild) => guild.id);
client.user.setActivity(`Music in ${guilds.length} Servers!`, {
type: "PLAYING",
});
},
};
3 changes: 2 additions & 1 deletion events/ready.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ module.exports = {
}
});
console.log(`Ready! Logged in as ${client.user.tag}`);
client.user.setActivity(`Music in ${client.guilds.cache.size} Servers!`, {
const guilds = client.guilds.cache.map((guild) => guild.id);
client.user.setActivity(`Music in ${guilds.length} Servers!`, {
type: "PLAYING",
});
},
Expand Down

0 comments on commit 92608a7

Please sign in to comment.