feat: improve editor interaction feedback and maintain active state during updates
This commit is contained in:
@@ -627,19 +627,32 @@ async function handleSaveBlock(
|
||||
}
|
||||
|
||||
async function handleCancelBlock(interaction: ButtonInteraction, editorMessage: Message): Promise<void> {
|
||||
await interaction.update({
|
||||
content: "❌ **Editor cancelado**\n\nLa creación del bloque ha sido cancelada.",
|
||||
components: [],
|
||||
embeds: []
|
||||
try {
|
||||
await interaction.deferUpdate();
|
||||
} catch {}
|
||||
await updateEditor(editorMessage, {
|
||||
display: {
|
||||
type: 17,
|
||||
components: [
|
||||
{ type: 10, content: "❌ **Editor cancelado**" },
|
||||
{ type: 10, content: "La creación del bloque ha sido cancelada." }
|
||||
]
|
||||
} as any,
|
||||
components: []
|
||||
});
|
||||
}
|
||||
|
||||
async function handleEditorTimeout(editorMessage: Message): Promise<void> {
|
||||
try {
|
||||
await editorMessage.edit({
|
||||
content: "⏰ **Editor expirado**\n\nEl editor ha expirado por inactividad. Usa el comando nuevamente para crear un bloque.",
|
||||
components: [],
|
||||
embeds: []
|
||||
await updateEditor(editorMessage, {
|
||||
display: {
|
||||
type: 17,
|
||||
components: [
|
||||
{ type: 10, content: "⏰ **Editor expirado**" },
|
||||
{ type: 10, content: "El editor ha expirado por inactividad. Usa el comando nuevamente para crear un bloque." }
|
||||
]
|
||||
} as any,
|
||||
components: []
|
||||
});
|
||||
} catch {
|
||||
// message likely deleted
|
||||
|
||||
@@ -202,19 +202,18 @@ export const command: CommandMessage = {
|
||||
//@ts-ignore
|
||||
data: { config: blockState }
|
||||
});
|
||||
// Mantener el editor activo y los botones funcionando
|
||||
await updateEditor(editorMessage, {
|
||||
// @ts-ignore
|
||||
display: {
|
||||
type: 17,
|
||||
accent_color: blockState.color ?? null,
|
||||
components: [
|
||||
{ type: 10, content: `✅ Actualizado: ${blockName}` },
|
||||
{ type: 10, content: "Cambios guardados en la base de datos." }
|
||||
]
|
||||
},
|
||||
components: []
|
||||
display: await renderPreview(blockState, message.member, message.guild),
|
||||
components: btns(false)
|
||||
});
|
||||
collector.stop();
|
||||
// Confirmación efímera
|
||||
try {
|
||||
// @ts-ignore
|
||||
await i.followUp({ flags: 64, content: `✅ Cambios de "${blockName}" guardados.` });
|
||||
} catch {}
|
||||
// No detener el collector para permitir mover/eliminar después de guardar
|
||||
return;
|
||||
}
|
||||
case "cancel_block": {
|
||||
|
||||
Reference in New Issue
Block a user