Skip to content

Commit

Permalink
[Enhancement] No need to loop through the guilds list to get the size…
Browse files Browse the repository at this point in the history
… anymore
  • Loading branch information
naseif committed Nov 25, 2021
1 parent 23f000d commit 063bb47
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
13 changes: 7 additions & 6 deletions events/guildCreate.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,18 @@ module.exports = {
async execute(guild) {
if (guild.systemChannel) {
guild.systemChannel.send({
content:
`**Thanks for adding me to your server!**\n- I am programmed with discord's latest slash commands feature!\n- to use me just type / and select a command to get started!\n- I also support commands with aliases, type \`${prefix}help\` for more Info.\n- To set a custom prefix, type \`${prefix}setup <new prefix>\``,
content: `**Thanks for adding me to your server!**\n- I am programmed with discord's latest slash commands feature!\n- to use me just type / and select a command to get started!\n- I also support commands with aliases, type \`${prefix}help\` for more Info.\n- To set a custom prefix, type \`${prefix}setup <new prefix>\``,
files: ["https://nekos.best/api/v1/cuddle/017.gif"],
});
} else {
return;
}
await registerSlashCommands(guild.client.user.id, guild.id);
const guilds = guild.client.guilds.cache.map((guild) => guild.id);
guild.client.user.setActivity(`Music in ${guilds.length} Servers!`, {
type: "PLAYING",
});
guild.client.user.setActivity(
`Music in ${client.guilds.cache.size} Servers!`,
{
type: "PLAYING",
}
);
},
};
10 changes: 6 additions & 4 deletions events/guildDelete.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
module.exports = {
name: "guildDelete",
async execute(guild) {
const guilds = guild.client.guilds.cache.map((guild) => guild.id);
guild.client.user.setActivity(`Music in ${guilds.length} Servers!`, {
type: "PLAYING",
});
guild.client.user.setActivity(
`Music in ${client.guilds.cache.size} Servers!`,
{
type: "PLAYING",
}
);
},
};
3 changes: 1 addition & 2 deletions events/ready.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ module.exports = {
}
});
console.log(`Ready! Logged in as ${client.user.tag}`);
const guilds = client.guilds.cache.map((guild) => guild.id);
client.user.setActivity(`Music in ${guilds.length} Servers!`, {
client.user.setActivity(`Music in ${client.guilds.cache.size} Servers!`, {
type: "PLAYING",
});
},
Expand Down

0 comments on commit 063bb47

Please sign in to comment.