From 12156dee7de59e7bd54d39755c3e42d38cf2ecdc Mon Sep 17 00:00:00 2001 From: Erit Islami Date: Sun, 19 Feb 2023 21:04:41 +0100 Subject: [PATCH] :bug: Fix reaction interaction responses --- commands/loop.ts | 9 ++++++--- commands/pause.ts | 5 ++++- commands/resume.ts | 12 ++++++++---- commands/shuffle.ts | 5 ++++- 4 files changed, 22 insertions(+), 9 deletions(-) diff --git a/commands/loop.ts b/commands/loop.ts index f879da009..7e52fa5d1 100644 --- a/commands/loop.ts +++ b/commands/loop.ts @@ -17,8 +17,11 @@ export default { queue.loop = !queue.loop; - return interaction - .reply({ content: i18n.__mf("loop.result", { loop: queue.loop ? i18n.__("common.on") : i18n.__("common.off") }) }) - .catch(console.error); + const content = { + content: i18n.__mf("loop.result", { loop: queue.loop ? i18n.__("common.on") : i18n.__("common.off") }) + }; + + if (interaction.replied) interaction.followUp(content).catch(console.error); + else interaction.reply(content).catch(console.error); } }; diff --git a/commands/pause.ts b/commands/pause.ts index 24231bb1a..af568f674 100644 --- a/commands/pause.ts +++ b/commands/pause.ts @@ -14,7 +14,10 @@ export default { if (!canModifyQueue(guildMemer!)) return i18n.__("common.errorNotChannel"); if (queue.player.pause()) { - interaction.reply({ content: i18n.__mf("pause.result", { author: interaction.user.id }) }).catch(console.error); + const content = { content: i18n.__mf("pause.result", { author: interaction.user.id }) }; + + if (interaction.replied) interaction.followUp(content).catch(console.error); + else interaction.reply(content).catch(console.error); return true; } diff --git a/commands/resume.ts b/commands/resume.ts index aa96719cb..d2ae04d70 100644 --- a/commands/resume.ts +++ b/commands/resume.ts @@ -15,14 +15,18 @@ export default { if (!canModifyQueue(guildMemer!)) return i18n.__("common.errorNotChannel"); if (queue.player.unpause()) { - interaction - .reply({ content: i18n.__mf("resume.resultNotPlaying", { author: interaction.user.id }) }) - .catch(console.error); + const content = { content: i18n.__mf("resume.resultNotPlaying", { author: interaction.user.id }) }; + + if (interaction.replied) interaction.followUp(content).catch(console.error); + else interaction.reply(content).catch(console.error); return true; } - interaction.reply({ content: i18n.__("resume.errorPlaying") }).catch(console.error); + const content = { content: i18n.__("resume.errorPlaying") }; + + if (interaction.replied) interaction.followUp(content).catch(console.error); + else interaction.reply(content).catch(console.error); return false; } }; diff --git a/commands/shuffle.ts b/commands/shuffle.ts index af85ada62..6e9c371b3 100644 --- a/commands/shuffle.ts +++ b/commands/shuffle.ts @@ -23,6 +23,9 @@ export default { queue.songs = songs; - interaction.reply({ content: i18n.__mf("shuffle.result", { author: interaction.user.id }) }).catch(console.error); + const content = { content: i18n.__mf("shuffle.result", { author: interaction.user.id }) }; + + if (interaction.replied) interaction.followUp(content).catch(console.error); + else interaction.reply(content).catch(console.error); } };