feat: update button interaction replies to use MessageFlags for ephemeral messages

This commit is contained in:
2025-09-23 23:41:20 -05:00
parent eb92edb19a
commit ff7745469c
5 changed files with 21 additions and 21 deletions

View File

@@ -1,4 +1,4 @@
import type { ButtonInteraction } from 'discord.js'; import {ButtonInteraction, MessageFlags} from 'discord.js';
import {clearGlobalCommands} from '../../core/api/discordAPI'; import {clearGlobalCommands} from '../../core/api/discordAPI';
const OWNER_ID = '327207082203938818'; const OWNER_ID = '327207082203938818';
@@ -8,7 +8,7 @@ export default {
customId: 'cmd_clear_global', customId: 'cmd_clear_global',
run: async (interaction: ButtonInteraction) => { run: async (interaction: ButtonInteraction) => {
if (interaction.user.id !== OWNER_ID) { if (interaction.user.id !== OWNER_ID) {
return interaction.reply({ content: '❌ No autorizado.', ephemeral: true }); return interaction.reply({ content: '❌ No autorizado.', flags: MessageFlags.Ephemeral });
} }
if (running) { if (running) {
return interaction.reply({ content: '⏳ Limpieza GLOBAL en progreso, espera.', ephemeral: true }); return interaction.reply({ content: '⏳ Limpieza GLOBAL en progreso, espera.', ephemeral: true });

View File

@@ -1,4 +1,4 @@
import type { ButtonInteraction } from 'discord.js'; import {ButtonInteraction, MessageFlags} from 'discord.js';
import { clearAllCommands } from '../../core/api/discordAPI'; import { clearAllCommands } from '../../core/api/discordAPI';
const OWNER_ID = '327207082203938818'; const OWNER_ID = '327207082203938818';
@@ -8,14 +8,14 @@ export default {
customId: 'cmd_clear_guild', customId: 'cmd_clear_guild',
run: async (interaction: ButtonInteraction) => { run: async (interaction: ButtonInteraction) => {
if (interaction.user.id !== OWNER_ID) { if (interaction.user.id !== OWNER_ID) {
return interaction.reply({ content: '❌ No autorizado.', ephemeral: true }); return interaction.reply({ content: '❌ No autorizado.', flags: MessageFlags.Ephemeral});
} }
if (running) { if (running) {
return interaction.reply({ content: '⏳ Limpieza GUILD en progreso, espera.', ephemeral: true }); return interaction.reply({ content: '⏳ Limpieza GUILD en progreso, espera.', flags: MessageFlags.Ephemeral });
} }
running = true; running = true;
try { try {
await interaction.deferReply({ ephemeral: true }); await interaction.deferReply({ flags: MessageFlags.Ephemeral });
await clearAllCommands(); await clearAllCommands();
await interaction.editReply('🧹 Comandos de GUILD eliminados.'); await interaction.editReply('🧹 Comandos de GUILD eliminados.');
} catch (e: any) { } catch (e: any) {
@@ -23,7 +23,7 @@ export default {
if (interaction.deferred || interaction.replied) { if (interaction.deferred || interaction.replied) {
await interaction.editReply('❌ Error limpiando comandos de guild.'); await interaction.editReply('❌ Error limpiando comandos de guild.');
} else { } else {
await interaction.reply({ content: '❌ Error limpiando comandos de guild.', ephemeral: true }); await interaction.reply({ content: '❌ Error limpiando comandos de guild.', flags: MessageFlags.Ephemeral });
} }
} finally { } finally {
running = false; running = false;

View File

@@ -1,4 +1,4 @@
import type { ButtonInteraction } from 'discord.js'; import {ButtonInteraction, MessageFlags} from 'discord.js';
import { buildAdminPanel } from '../../commands/messages/net/commandsAdmin'; import { buildAdminPanel } from '../../commands/messages/net/commandsAdmin';
const OWNER_ID = '327207082203938818'; const OWNER_ID = '327207082203938818';
@@ -7,7 +7,7 @@ export default {
customId: 'cmd_mem_refresh', customId: 'cmd_mem_refresh',
run: async (interaction: ButtonInteraction) => { run: async (interaction: ButtonInteraction) => {
if (interaction.user.id !== OWNER_ID) { if (interaction.user.id !== OWNER_ID) {
return interaction.reply({ content: '❌ No autorizado.', ephemeral: true }); return interaction.reply({ content: '❌ No autorizado.', flags: MessageFlags.Ephemeral });
} }
try { try {
await interaction.deferUpdate(); await interaction.deferUpdate();
@@ -17,7 +17,7 @@ export default {
} catch (e) { } catch (e) {
console.error('Error refrescando panel de memoria:', e); console.error('Error refrescando panel de memoria:', e);
if (!interaction.deferred && !interaction.replied) if (!interaction.deferred && !interaction.replied)
await interaction.reply({ content: '❌ Error refrescando panel.', ephemeral: true }); await interaction.reply({ content: '❌ Error refrescando panel.', flags: MessageFlags.Ephemeral });
} }
} }
}; };

View File

@@ -1,4 +1,4 @@
import type { ButtonInteraction } from 'discord.js'; import {ButtonInteraction, MessageFlags} from 'discord.js';
import { registeringGlobalCommands } from '../../core/api/discordAPI'; import { registeringGlobalCommands } from '../../core/api/discordAPI';
const OWNER_ID = '327207082203938818'; const OWNER_ID = '327207082203938818';
@@ -8,14 +8,14 @@ export default {
customId: 'cmd_reg_global', customId: 'cmd_reg_global',
run: async (interaction: ButtonInteraction) => { run: async (interaction: ButtonInteraction) => {
if (interaction.user.id !== OWNER_ID) { if (interaction.user.id !== OWNER_ID) {
return interaction.reply({ content: '❌ No autorizado.', ephemeral: true }); return interaction.reply({ content: '❌ No autorizado.', flags: MessageFlags.Ephemeral });
} }
if (running) { if (running) {
return interaction.reply({ content: '⏳ Ya hay un registro GLOBAL en curso, espera.', ephemeral: true }); return interaction.reply({ content: '⏳ Ya hay un registro GLOBAL en curso, espera.', flags: MessageFlags.Ephemeral });
} }
running = true; running = true;
try { try {
await interaction.deferReply({ ephemeral: true }); await interaction.deferReply({ flags: MessageFlags.Ephemeral });
await registeringGlobalCommands(); await registeringGlobalCommands();
await interaction.editReply('✅ Comandos GLOBAL registrados (propagación puede tardar).'); await interaction.editReply('✅ Comandos GLOBAL registrados (propagación puede tardar).');
} catch (e: any) { } catch (e: any) {
@@ -23,7 +23,7 @@ export default {
if (interaction.deferred || interaction.replied) { if (interaction.deferred || interaction.replied) {
await interaction.editReply('❌ Error registrando comandos globales.'); await interaction.editReply('❌ Error registrando comandos globales.');
} else { } else {
await interaction.reply({ content: '❌ Error registrando comandos globales.', ephemeral: true }); await interaction.reply({ content: '❌ Error registrando comandos globales.', flags: MessageFlags.Ephemeral});
} }
} finally { } finally {
running = false; running = false;

View File

@@ -1,4 +1,4 @@
import type { ButtonInteraction } from 'discord.js'; import {ButtonInteraction, MessageFlags} from 'discord.js';
import { registeringCommands } from '../../core/api/discordAPI'; import { registeringCommands } from '../../core/api/discordAPI';
const OWNER_ID = '327207082203938818'; const OWNER_ID = '327207082203938818';
@@ -8,14 +8,14 @@ export default {
customId: 'cmd_reg_guild', customId: 'cmd_reg_guild',
run: async (interaction: ButtonInteraction) => { run: async (interaction: ButtonInteraction) => {
if (interaction.user.id !== OWNER_ID) { if (interaction.user.id !== OWNER_ID) {
return interaction.reply({ content: '❌ No autorizado.', ephemeral: true }); return interaction.reply({ content: '❌ No autorizado.', flags: MessageFlags.Ephemeral });
} }
if (running) { if (running) {
return interaction.reply({ content: '⏳ Ya hay un registro de comandos guild en curso, espera.', ephemeral: true }); return interaction.reply({ content: '⏳ Ya hay un registro de comandos guild en curso, espera.', flags: MessageFlags.Ephemeral });
} }
running = true; running = true;
try { try {
await interaction.deferReply({ ephemeral: true }); await interaction.deferReply({ flags: MessageFlags.Ephemeral});
await registeringCommands(); await registeringCommands();
await interaction.editReply('✅ Comandos de GUILD registrados correctamente.'); await interaction.editReply('✅ Comandos de GUILD registrados correctamente.');
} catch (e: any) { } catch (e: any) {
@@ -23,7 +23,7 @@ export default {
if (interaction.deferred || interaction.replied) { if (interaction.deferred || interaction.replied) {
await interaction.editReply('❌ Error registrando comandos de guild. Revisa logs.'); await interaction.editReply('❌ Error registrando comandos de guild. Revisa logs.');
} else { } else {
await interaction.reply({ content: '❌ Error registrando comandos de guild.', ephemeral: true }); await interaction.reply({ content: '❌ Error registrando comandos de guild.', flags: MessageFlags.Ephemeral});
} }
} finally { } finally {
running = false; running = false;