From cf41cc2869fc2fa2c0ac4271316405d558be7fc3 Mon Sep 17 00:00:00 2001 From: shni Date: Fri, 3 Oct 2025 22:38:28 -0500 Subject: [PATCH] feat: update interaction handling to use flags and improve button interaction checks --- .../alliaces/deleteDisplayComponent.ts | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/commands/messages/alliaces/deleteDisplayComponent.ts b/src/commands/messages/alliaces/deleteDisplayComponent.ts index bdd837f..b11d1ce 100644 --- a/src/commands/messages/alliaces/deleteDisplayComponent.ts +++ b/src/commands/messages/alliaces/deleteDisplayComponent.ts @@ -215,7 +215,7 @@ async function handlePanelInteractions( if (!interaction.replied && !interaction.deferred) { await interaction.reply({ content: "❌ Ocurrió un error al procesar la interacción.", - ephemeral: true + flags: 64 // Use flags instead of ephemeral }); } } @@ -283,12 +283,14 @@ async function handleBlockSelection( filter: (i: MessageComponentInteraction) => i.user.id === interaction.user.id }); - finalCollector.on("collect", async (finalInteraction: ButtonInteraction) => { + finalCollector.on("collect", async (finalInteraction: MessageComponentInteraction) => { try { - if (finalInteraction.customId === "cancel_delete_final") { - await handleCancellation(finalInteraction); - } else if (finalInteraction.customId === `confirm_delete_${selectedBlock.id}`) { - await executeBlockDeletion(finalInteraction, client, selectedBlock); + if (finalInteraction.isButton()) { + if (finalInteraction.customId === "cancel_delete_final") { + await handleCancellation(finalInteraction); + } else if (finalInteraction.customId === `confirm_delete_${selectedBlock.id}`) { + await executeBlockDeletion(finalInteraction, client, selectedBlock); + } } finalCollector.stop(); } catch (error) { @@ -314,12 +316,14 @@ async function handleConfirmationInteraction( filter: (interaction: MessageComponentInteraction) => interaction.user.id === originalMessage.author.id }); - collector.on("collect", async (interaction: ButtonInteraction) => { + collector.on("collect", async (interaction: MessageComponentInteraction) => { try { - if (interaction.customId === "cancel_delete") { - await handleCancellation(interaction); - } else if (interaction.customId === `confirm_delete_${block.id}`) { - await executeBlockDeletion(interaction, client, { name: block.name, id: block.id }); + if (interaction.isButton()) { + if (interaction.customId === "cancel_delete") { + await handleCancellation(interaction); + } else if (interaction.customId === `confirm_delete_${block.id}`) { + await executeBlockDeletion(interaction, client, { name: block.name, id: block.id }); + } } collector.stop(); } catch (error) {