feat: update button interaction replies to use MessageFlags for ephemeral messages
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import type { ButtonInteraction } from 'discord.js';
|
||||
import { clearGlobalCommands } from '../../core/api/discordAPI';
|
||||
import {ButtonInteraction, MessageFlags} from 'discord.js';
|
||||
import {clearGlobalCommands} from '../../core/api/discordAPI';
|
||||
|
||||
const OWNER_ID = '327207082203938818';
|
||||
let running = false;
|
||||
@@ -8,7 +8,7 @@ export default {
|
||||
customId: 'cmd_clear_global',
|
||||
run: async (interaction: ButtonInteraction) => {
|
||||
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) {
|
||||
return interaction.reply({ content: '⏳ Limpieza GLOBAL en progreso, espera.', ephemeral: true });
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { ButtonInteraction } from 'discord.js';
|
||||
import {ButtonInteraction, MessageFlags} from 'discord.js';
|
||||
import { clearAllCommands } from '../../core/api/discordAPI';
|
||||
|
||||
const OWNER_ID = '327207082203938818';
|
||||
@@ -8,14 +8,14 @@ export default {
|
||||
customId: 'cmd_clear_guild',
|
||||
run: async (interaction: ButtonInteraction) => {
|
||||
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) {
|
||||
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;
|
||||
try {
|
||||
await interaction.deferReply({ ephemeral: true });
|
||||
await interaction.deferReply({ flags: MessageFlags.Ephemeral });
|
||||
await clearAllCommands();
|
||||
await interaction.editReply('🧹 Comandos de GUILD eliminados.');
|
||||
} catch (e: any) {
|
||||
@@ -23,7 +23,7 @@ export default {
|
||||
if (interaction.deferred || interaction.replied) {
|
||||
await interaction.editReply('❌ Error limpiando comandos de guild.');
|
||||
} 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 {
|
||||
running = false;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { ButtonInteraction } from 'discord.js';
|
||||
import {ButtonInteraction, MessageFlags} from 'discord.js';
|
||||
import { buildAdminPanel } from '../../commands/messages/net/commandsAdmin';
|
||||
|
||||
const OWNER_ID = '327207082203938818';
|
||||
@@ -7,7 +7,7 @@ export default {
|
||||
customId: 'cmd_mem_refresh',
|
||||
run: async (interaction: ButtonInteraction) => {
|
||||
if (interaction.user.id !== OWNER_ID) {
|
||||
return interaction.reply({ content: '❌ No autorizado.', ephemeral: true });
|
||||
return interaction.reply({ content: '❌ No autorizado.', flags: MessageFlags.Ephemeral });
|
||||
}
|
||||
try {
|
||||
await interaction.deferUpdate();
|
||||
@@ -17,7 +17,7 @@ export default {
|
||||
} catch (e) {
|
||||
console.error('Error refrescando panel de memoria:', e);
|
||||
if (!interaction.deferred && !interaction.replied)
|
||||
await interaction.reply({ content: '❌ Error refrescando panel.', ephemeral: true });
|
||||
await interaction.reply({ content: '❌ Error refrescando panel.', flags: MessageFlags.Ephemeral });
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { ButtonInteraction } from 'discord.js';
|
||||
import {ButtonInteraction, MessageFlags} from 'discord.js';
|
||||
import { registeringGlobalCommands } from '../../core/api/discordAPI';
|
||||
|
||||
const OWNER_ID = '327207082203938818';
|
||||
@@ -8,14 +8,14 @@ export default {
|
||||
customId: 'cmd_reg_global',
|
||||
run: async (interaction: ButtonInteraction) => {
|
||||
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) {
|
||||
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;
|
||||
try {
|
||||
await interaction.deferReply({ ephemeral: true });
|
||||
await interaction.deferReply({ flags: MessageFlags.Ephemeral });
|
||||
await registeringGlobalCommands();
|
||||
await interaction.editReply('✅ Comandos GLOBAL registrados (propagación puede tardar).');
|
||||
} catch (e: any) {
|
||||
@@ -23,7 +23,7 @@ export default {
|
||||
if (interaction.deferred || interaction.replied) {
|
||||
await interaction.editReply('❌ Error registrando comandos globales.');
|
||||
} else {
|
||||
await interaction.reply({ content: '❌ Error registrando comandos globales.', ephemeral: true });
|
||||
await interaction.reply({ content: '❌ Error registrando comandos globales.', flags: MessageFlags.Ephemeral});
|
||||
}
|
||||
} finally {
|
||||
running = false;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { ButtonInteraction } from 'discord.js';
|
||||
import {ButtonInteraction, MessageFlags} from 'discord.js';
|
||||
import { registeringCommands } from '../../core/api/discordAPI';
|
||||
|
||||
const OWNER_ID = '327207082203938818';
|
||||
@@ -8,14 +8,14 @@ export default {
|
||||
customId: 'cmd_reg_guild',
|
||||
run: async (interaction: ButtonInteraction) => {
|
||||
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) {
|
||||
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;
|
||||
try {
|
||||
await interaction.deferReply({ ephemeral: true });
|
||||
await interaction.deferReply({ flags: MessageFlags.Ephemeral});
|
||||
await registeringCommands();
|
||||
await interaction.editReply('✅ Comandos de GUILD registrados correctamente.');
|
||||
} catch (e: any) {
|
||||
@@ -23,7 +23,7 @@ export default {
|
||||
if (interaction.deferred || interaction.replied) {
|
||||
await interaction.editReply('❌ Error registrando comandos de guild. Revisa logs.');
|
||||
} 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 {
|
||||
running = false;
|
||||
|
||||
Reference in New Issue
Block a user