From 2d7ffc1a3ff9f58740dd1c77078feadcce6478d7 Mon Sep 17 00:00:00 2001 From: Marius Begby Date: Thu, 14 Sep 2023 13:04:32 +0200 Subject: [PATCH] fix: use Promise.all when fetching info for status commands --- src/interactions/commands/info/status.ts | 8 +++++--- src/interactions/commands/system/systemstatus.ts | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/interactions/commands/info/status.ts b/src/interactions/commands/info/status.ts index 7bea0e5..b56e4f7 100644 --- a/src/interactions/commands/info/status.ts +++ b/src/interactions/commands/info/status.ts @@ -15,9 +15,11 @@ class StatusCommand extends BaseSlashCommandInteraction { const { executionId, interaction, client } = params; const logger = this.getLogger(this.name, executionId, interaction); - const botStatisticsEmbedString = await getBotStatistics(client!, version); - const playerStatisticsEmbedString = await getPlayerStatistics(client!); - const systemStatusEmbedString = await getSystemStatus(executionId, false); + const [botStatisticsEmbedString, playerStatisticsEmbedString, systemStatusEmbedString] = await Promise.all([ + getBotStatistics(client!, version), + getPlayerStatistics(client!), + getSystemStatus(executionId, false) + ]); const discordStatus = getDiscordStatus(client!); logger.debug('Responding with info embed.'); diff --git a/src/interactions/commands/system/systemstatus.ts b/src/interactions/commands/system/systemstatus.ts index ed8b1b1..d9277b9 100644 --- a/src/interactions/commands/system/systemstatus.ts +++ b/src/interactions/commands/system/systemstatus.ts @@ -21,9 +21,11 @@ class SystemStatusCommand extends BaseSlashCommandInteraction { await this.runValidators({ interaction, executionId }, [checkValidGuildId]); - const botStatisticsEmbedString = await getBotStatistics(client!, version); - const playerStatisticsEmbedString = await getPlayerStatistics(client!); - const systemStatusEmbedString = await getSystemStatus(executionId, true); + const [botStatisticsEmbedString, playerStatisticsEmbedString, systemStatusEmbedString] = await Promise.all([ + getBotStatistics(client!, version), + getPlayerStatistics(client!), + getSystemStatus(executionId, false) + ]); const discordStatusEmbedString = getDiscordStatus(client!); const dependenciesEmbedString = this.getDependencies();