From 578542e54e6b05ad92e1b5475c462913bc9e7c28 Mon Sep 17 00:00:00 2001 From: Dragory <2606411+Dragory@users.noreply.github.com> Date: Mon, 3 May 2021 20:51:16 +0300 Subject: [PATCH] Show loading message for !counters reset_all --- .../plugins/Counters/commands/ResetAllCounterValuesCmd.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/backend/src/plugins/Counters/commands/ResetAllCounterValuesCmd.ts b/backend/src/plugins/Counters/commands/ResetAllCounterValuesCmd.ts index 1868ef37..930d5b2b 100644 --- a/backend/src/plugins/Counters/commands/ResetAllCounterValuesCmd.ts +++ b/backend/src/plugins/Counters/commands/ResetAllCounterValuesCmd.ts @@ -4,7 +4,7 @@ import { commandTypeHelpers as ct } from "../../../commandTypes"; import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils"; import { resolveChannel, waitForReply } from "knub/dist/helpers"; import { TextChannel, User } from "eris"; -import { confirm, resolveUser, trimMultilineString, UnknownUser } from "../../../utils"; +import { confirm, noop, resolveUser, trimMultilineString, UnknownUser } from "../../../utils"; import { changeCounterValue } from "../functions/changeCounterValue"; import { setCounterValue } from "../functions/setCounterValue"; import { resetAllCounterValues } from "../functions/resetAllCounterValues"; @@ -48,10 +48,15 @@ export const ResetAllCounterValuesCmd = guildCommand()({ return; } + const loadingMessage = await message.channel + .createMessage(`Resetting counter **${counterName}**. This might take a while. Please don't reload the config.`) + .catch(() => null); + const lock = await pluginData.locks.acquire(counterIdLock(counterId)); await resetAllCounterValues(pluginData, args.counterName); lock.interrupt(); + loadingMessage?.delete().catch(noop); sendSuccessMessage(pluginData, message.channel, `All counter values for **${counterName}** have been reset`); pluginData.getKnubInstance().reloadGuild(pluginData.guild.id);