Files
amayo/src/components/modals/prefixSettingsModal.ts

33 lines
1.2 KiB
TypeScript
Raw Normal View History

import {ModalSubmitInteraction, MessageFlags} from "discord.js";
import type { Modal } from '../../core/types/components';
import type Amayo from '../../core/client';
2025-09-17 13:33:10 -05:00
export default {
2025-09-17 13:33:10 -05:00
customId: "prefixsettingsmodal",
run: async (interaction: ModalSubmitInteraction, client: Amayo) => {
const newPrefix = interaction.fields.getTextInputValue("prefixInput");
2025-09-17 13:33:10 -05:00
if (!newPrefix || newPrefix.length > 10) {
return interaction.reply({
content: '❌ El prefix debe tener entre 1 y 10 caracteres.',
flags: MessageFlags.Ephemeral
});
}
2025-09-17 13:33:10 -05:00
try {
// Aquí puedes guardar el prefix en la base de datos usando client.prisma
// Por ahora solo confirmamos el cambio
await interaction.reply({
content: `✅ Prefix cambiado a: \`${newPrefix}\``,
flags: MessageFlags.Ephemeral
});
} catch (error) {
console.error('Error cambiando prefix:', error);
await interaction.reply({
content: '❌ Error al cambiar el prefix.',
flags: MessageFlags.Ephemeral
});
}
2025-09-17 13:33:10 -05:00
}
} satisfies Modal;