Skip to content

Commit

Permalink
🐛 Fix reaction interaction responses
Browse files Browse the repository at this point in the history
  • Loading branch information
eritislami committed Feb 19, 2023
1 parent e2509bd commit 12156de
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 9 deletions.
9 changes: 6 additions & 3 deletions commands/loop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
};
5 changes: 4 additions & 1 deletion commands/pause.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
12 changes: 8 additions & 4 deletions commands/resume.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
};
5 changes: 4 additions & 1 deletion commands/shuffle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
};

0 comments on commit 12156de

Please sign in to comment.