From 6df67da3cb858a57954efaabe066e33690ac9bc0 Mon Sep 17 00:00:00 2001 From: Dragory <2606411+Dragory@users.noreply.github.com> Date: Wed, 1 Jun 2022 18:58:54 +0300 Subject: [PATCH] debug: catch & trace interaction reply errors --- .../src/plugins/Mutes/commands/MutesCmd.ts | 4 ++- .../RoleButtons/events/buttonInteraction.ts | 30 +++++++++++-------- backend/src/plugins/Utility/search.ts | 4 ++- backend/src/utils/waitForInteraction.ts | 4 ++- 4 files changed, 27 insertions(+), 15 deletions(-) diff --git a/backend/src/plugins/Mutes/commands/MutesCmd.ts b/backend/src/plugins/Mutes/commands/MutesCmd.ts index eeff2c4f..5c4e9d3a 100644 --- a/backend/src/plugins/Mutes/commands/MutesCmd.ts +++ b/backend/src/plugins/Mutes/commands/MutesCmd.ts @@ -205,7 +205,9 @@ export const MutesCmd = mutesCmd({ collector.on("collect", async (interaction: MessageComponentInteraction) => { if (msg.author.id !== interaction.user.id) { - interaction.reply({ content: `You are not permitted to use these buttons.`, ephemeral: true }); + interaction + .reply({ content: `You are not permitted to use these buttons.`, ephemeral: true }) + .catch((err) => console.trace(err.message)); } else { collector.resetTimer(); await interaction.deferUpdate(); diff --git a/backend/src/plugins/RoleButtons/events/buttonInteraction.ts b/backend/src/plugins/RoleButtons/events/buttonInteraction.ts index 1eeb8f91..579ea7e9 100644 --- a/backend/src/plugins/RoleButtons/events/buttonInteraction.ts +++ b/backend/src/plugins/RoleButtons/events/buttonInteraction.ts @@ -23,10 +23,12 @@ export const onButtonInteraction = typedGuildEventListener console.trace(err.message)); return; } @@ -39,10 +41,12 @@ export const onButtonInteraction = typedGuildEventListener console.trace(err.message)); } else { rolesToAdd.push(option.role_id); @@ -54,10 +58,12 @@ export const onButtonInteraction = typedGuildEventListener console.trace(err.message)); } for (const roleId of rolesToAdd) { diff --git a/backend/src/plugins/Utility/search.ts b/backend/src/plugins/Utility/search.ts index b2b417b7..440652b5 100644 --- a/backend/src/plugins/Utility/search.ts +++ b/backend/src/plugins/Utility/search.ts @@ -192,7 +192,9 @@ export async function displaySearch( collector.on("collect", async (interaction: MessageComponentInteraction) => { if (msg.author.id !== interaction.user.id) { - interaction.reply({ content: `You are not permitted to use these buttons.`, ephemeral: true }); + interaction + .reply({ content: `You are not permitted to use these buttons.`, ephemeral: true }) + .catch((err) => console.trace(err.message)); } else { if (interaction.customId === `previousButton:${idMod}` && currentPage > 1) { collector.stop(); diff --git a/backend/src/utils/waitForInteraction.ts b/backend/src/utils/waitForInteraction.ts index d39467c9..ece841ca 100644 --- a/backend/src/utils/waitForInteraction.ts +++ b/backend/src/utils/waitForInteraction.ts @@ -27,7 +27,9 @@ export async function waitForButtonConfirm( collector.on("collect", (interaction: MessageComponentInteraction) => { if (options?.restrictToId && options.restrictToId !== interaction.user.id) { - interaction.reply({ content: `You are not permitted to use these buttons.`, ephemeral: true }); + interaction + .reply({ content: `You are not permitted to use these buttons.`, ephemeral: true }) + .catch((err) => console.trace(err.message)); } else { if (interaction.customId.startsWith(`confirmButton:${idMod}:`)) { message.delete();