feat: update interaction handling to use flags and improve button interaction checks
This commit is contained in:
@@ -215,7 +215,7 @@ async function handlePanelInteractions(
|
|||||||
if (!interaction.replied && !interaction.deferred) {
|
if (!interaction.replied && !interaction.deferred) {
|
||||||
await interaction.reply({
|
await interaction.reply({
|
||||||
content: "❌ Ocurrió un error al procesar la interacción.",
|
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
|
filter: (i: MessageComponentInteraction) => i.user.id === interaction.user.id
|
||||||
});
|
});
|
||||||
|
|
||||||
finalCollector.on("collect", async (finalInteraction: ButtonInteraction) => {
|
finalCollector.on("collect", async (finalInteraction: MessageComponentInteraction) => {
|
||||||
try {
|
try {
|
||||||
if (finalInteraction.customId === "cancel_delete_final") {
|
if (finalInteraction.isButton()) {
|
||||||
await handleCancellation(finalInteraction);
|
if (finalInteraction.customId === "cancel_delete_final") {
|
||||||
} else if (finalInteraction.customId === `confirm_delete_${selectedBlock.id}`) {
|
await handleCancellation(finalInteraction);
|
||||||
await executeBlockDeletion(finalInteraction, client, selectedBlock);
|
} else if (finalInteraction.customId === `confirm_delete_${selectedBlock.id}`) {
|
||||||
|
await executeBlockDeletion(finalInteraction, client, selectedBlock);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
finalCollector.stop();
|
finalCollector.stop();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -314,12 +316,14 @@ async function handleConfirmationInteraction(
|
|||||||
filter: (interaction: MessageComponentInteraction) => interaction.user.id === originalMessage.author.id
|
filter: (interaction: MessageComponentInteraction) => interaction.user.id === originalMessage.author.id
|
||||||
});
|
});
|
||||||
|
|
||||||
collector.on("collect", async (interaction: ButtonInteraction) => {
|
collector.on("collect", async (interaction: MessageComponentInteraction) => {
|
||||||
try {
|
try {
|
||||||
if (interaction.customId === "cancel_delete") {
|
if (interaction.isButton()) {
|
||||||
await handleCancellation(interaction);
|
if (interaction.customId === "cancel_delete") {
|
||||||
} else if (interaction.customId === `confirm_delete_${block.id}`) {
|
await handleCancellation(interaction);
|
||||||
await executeBlockDeletion(interaction, client, { name: block.name, id: block.id });
|
} else if (interaction.customId === `confirm_delete_${block.id}`) {
|
||||||
|
await executeBlockDeletion(interaction, client, { name: block.name, id: block.id });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
collector.stop();
|
collector.stop();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user