diff --git a/src/discord/utils/commandDeploy.ts b/src/discord/utils/commandDeploy.ts index a28a65a36..e17700634 100644 --- a/src/discord/utils/commandDeploy.ts +++ b/src/discord/utils/commandDeploy.ts @@ -48,7 +48,9 @@ if (validateEnv('DISCORD')) { log.info(F, 'Commands successfully registered!'); }) .catch(ex => { - log.error(F, `Error in registering commands: ${ex}`); + log.error(F, 'Error in registering commands'); + // eslint-disable-next-line no-console + console.log(ex); process.exit(1); }); } diff --git a/src/global/commands/g.about.ts b/src/global/commands/g.about.ts index c813a6357..5785fc4f2 100644 --- a/src/global/commands/g.about.ts +++ b/src/global/commands/g.about.ts @@ -69,7 +69,7 @@ export default class About { public static readonly botInfo: string = stripIndents` TripBot is the main bot on the TripSit Discord guild and handles a little bit of everything, from harm reduction to fun commands.\ - It currently has ${discordClient.commands.size} commands and you can get info on each of them by using the drop down menu below.`; + It currently has 93 commands and you can get info on each of them by using the drop down menu below.`; public static readonly inviteInfo: string = stripIndents` Want to add TripBot to your server? It's as easy as clicking the button below! diff --git a/src/global/commands/g.botstats.ts b/src/global/commands/g.botstats.ts index 4d1b79f23..59a1109a3 100644 --- a/src/global/commands/g.botstats.ts +++ b/src/global/commands/g.botstats.ts @@ -47,28 +47,21 @@ export async function botStats():Promise { await discordClient.guilds.fetch(); response.guildCount = discordClient.guilds.cache.size; - response.userCount = 0; - - Promise.all( - discordClient.guilds.cache.map(async (guild) => { - try { - await guild.members.fetch(); - response.userCount += guild.memberCount; - } catch (e) { - // log.error(F, `Error fetching members for guild: ${guild.name}`); - } - }) - ); - - Promise.all( - discordClient.guilds.cache.map(async (guild) => { - try { - await guild.channels.fetch(); - } catch (e) { - // log.error(F, `Error fetching members for guild: ${guild.name}`); - } - }) - ); + + // Fetching member counts + const memberCountPromises = discordClient.guilds.cache.map(async (guild) => { + try { + await guild.members.fetch(); + return guild.memberCount; + } catch (e) { + // log.error(F, `Error fetching members for guild: ${guild.name}`); + return 0; + } + }); + + // Sum up all the member counts + const memberCounts = await Promise.all(memberCountPromises); + response.userCount = memberCounts.reduce((acc, count) => acc + count, 0); response.channelCount = discordClient.channels.cache.size; response.commandCount = discordClient.commands.size;