From 7890d4448265f9740e7d6cdf36f0041bdc5e89d7 Mon Sep 17 00:00:00 2001 From: "Jill \"oatmealine\" Monoids" Date: Fri, 26 Aug 2022 19:46:19 +0300 Subject: [PATCH] defer replies in counter commands --- src/commands/decrease.ts | 1 + src/commands/increase.ts | 1 + src/lib/counter.ts | 5 ++--- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/commands/decrease.ts b/src/commands/decrease.ts index 2154ad2..034e708 100644 --- a/src/commands/decrease.ts +++ b/src/commands/decrease.ts @@ -15,6 +15,7 @@ module.exports = { ), execute: async (interaction: CommandInteraction, member: GuildMember) => { + await interaction.deferReply({ephemeral: true}); const amount = Math.trunc(interaction.options.getNumber('amount') || 1); changeCounterInteraction(interaction, member, -amount); } diff --git a/src/commands/increase.ts b/src/commands/increase.ts index 11527e1..f5e2f2f 100644 --- a/src/commands/increase.ts +++ b/src/commands/increase.ts @@ -15,6 +15,7 @@ module.exports = { ), execute: async (interaction: CommandInteraction, member: GuildMember) => { + await interaction.deferReply({ephemeral: true}); const amount = Math.trunc(interaction.options.getNumber('amount') || 1); changeCounterInteraction(interaction, member, amount); } diff --git a/src/lib/counter.ts b/src/lib/counter.ts index 2d364c0..241422c 100644 --- a/src/lib/counter.ts +++ b/src/lib/counter.ts @@ -83,8 +83,7 @@ export async function changeCounterInteraction(interaction: CommandInteraction, const newCount = await changeCounter(amount); await updateCounter(interaction.client); await announceCounterUpdate(interaction.client, member, amount); - interaction.reply({ - content: `${EMOJI} **You have ${amount > 0 ? 'increased' : 'decreased'} the counter.**\n\`\`\`diff\n ${newCount - amount}\n${getSign(amount)}${Math.abs(amount)}\n ${newCount}\`\`\``, - ephemeral: true + interaction.followUp({ + content: `${EMOJI} **You have ${amount > 0 ? 'increased' : 'decreased'} the counter.**\n\`\`\`diff\n ${newCount - amount}\n${getSign(amount)}${Math.abs(amount)}\n ${newCount}\`\`\`` }); } \ No newline at end of file