From 5ddd430cbc49d4163372404ea1e4391acac63a1a Mon Sep 17 00:00:00 2001 From: SowinskiBraeden Date: Sun, 27 Oct 2024 16:10:51 -0700 Subject: [PATCH] update stats command to reflect all shards --- commands/stats.js | 6 +++++- config/config.js | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/commands/stats.js b/commands/stats.js index e7c3e7a..7af64de 100644 --- a/commands/stats.js +++ b/commands/stats.js @@ -23,11 +23,15 @@ module.exports = { return interaction.send({ content: `You are not allowed to use the bot in this channel.` }); } const { version } = require("discord.js"); + const totalGuilds = await client.shard.fetchClientValues("guilds.cache.size").then(results => { + return results.reduce((acc, guildCount) => acc + guildCount, 0) + }); + const totalMembers = await client.shard.broadcastEval(c => c.guilds.cache.reduce((acc, guild) => acc + guild.memberCount, 0)).then(data => data.reduce((acc, memberCount) => acc + memberCount, 0)); const stats = new EmbedBuilder() .setColor('#0099ff') .setTitle("Current LPC-Bot Statistics") .setURL(client.config.SupportServer) - .setDescription(`**Channels** : \`${client.channels.cache.size}\`\n**Servers** : \`${client.guilds.cache.size}\`\n**Users** : \`${client.users.cache.size}\``) + .setDescription(`**Servers** : \`${totalGuilds}\`\n**Users** : \`${totalMembers}\``) interaction.send({ embeds: [stats] }) }, }, diff --git a/config/config.js b/config/config.js index 6cb2a77..f4250bc 100644 --- a/config/config.js +++ b/config/config.js @@ -2,7 +2,7 @@ require('dotenv').config() module.exports = { Dev: "PRODUCTION", - Version: "3.2.2", + Version: "3.2.3", Admins: ["362791661274660874"], // Admins of the bot DefaultPrefix: "?", socket: "https://www.linespolice-cad.com/",