Skip to content

Commit

Permalink
Fix command deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
LunaUrsa committed Feb 5, 2024
1 parent 8e7e3ad commit f38fc96
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 24 deletions.
4 changes: 3 additions & 1 deletion src/discord/utils/commandDeploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
}
2 changes: 1 addition & 1 deletion src/global/commands/g.about.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Expand Down
37 changes: 15 additions & 22 deletions src/global/commands/g.botstats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,28 +47,21 @@ export async function botStats():Promise<BotStats> {

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;
Expand Down

0 comments on commit f38fc96

Please sign in to comment.