Skip to content
This repository has been archived by the owner on Jul 30, 2023. It is now read-only.

Commit

Permalink
Fix stats command
Browse files Browse the repository at this point in the history
  • Loading branch information
navi1995 committed Mar 15, 2021
1 parent 1d91989 commit abef04f
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions Discord Bot/commands/stats.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,28 @@ module.exports = {
async execute(message, args, main) {
const promises = [
main.client.shard.fetchClientValues('guilds.cache.size'),
main.client.shard.broadcastEval('this.guilds.cache.reduce((acc, guild) => acc + guild.memberCount)', 0),
main.client.shard.broadcastEval('this.guilds.cache.reduce((acc, guild) => acc + guild.memberCount, 0)'),
];

return Promise.all(promises)
.then(results => {
const totalGuilds = results[0].reduce((acc, guildCount) => acc + guildCount, 0);
const totalMembers = results[1].reduce((acc, memberCount) => acc + memberCount, 0);
return message.channel.send({ embed: {

return message.channel.send({embed: {
color: 0x03a9f4,
title: 'Bot Stats',
description: `Server count: ${totalGuilds}\nMember count: ${totalMembers}`
} });
fields: [
{
name: "Server Count",
value: totalGuilds
},
{
name: "Member Count",
value: totalMembers
}
]
}});
}).catch(console.error);
}
};

0 comments on commit abef04f

Please sign in to comment.