diff --git a/src/components/buttons/prefixSettings.ts b/src/components/buttons/prefixSettings.ts index ab63d1d..25f3a4e 100644 --- a/src/components/buttons/prefixSettings.ts +++ b/src/components/buttons/prefixSettings.ts @@ -1,22 +1,29 @@ import type {ButtonInteraction} from "discord.js"; -import { ActionRowBuilder, ModalBuilder, TextInputBuilder, TextInputStyle } from 'discord.js'; +import { ComponentType, TextInputStyle } from 'discord-api-types/v10'; import type { Button } from '../../core/types/components'; import type Amayo from '../../core/client'; export default { customId: "prefixsettings", run: async (interaction: ButtonInteraction, client: Amayo) => { - const modal = new ModalBuilder() - .setCustomId('prefixsettingsmodal') - .setTitle('Prefix'); - - const prefixInput = new TextInputBuilder() - .setCustomId('prefixInput') - .setLabel("Change Prefix") - .setStyle(TextInputStyle.Short); - - const secondActionRow = new ActionRowBuilder().addComponents(prefixInput); - modal.addComponents(secondActionRow); + const modal = { + title: 'Cambiar Prefix', + customId: 'prefixsettingsmodal', + components: [ + { + type: ComponentType.Label, + label: 'Nuevo Prefix', + component: { + type: ComponentType.TextInput, + customId: 'prefixInput', + style: TextInputStyle.Short, + required: true, + placeholder: 'Ej: !, ?, $', + maxLength: 5 + }, + }, + ], + } as const; await interaction.showModal(modal); } diff --git a/src/components/modals/prefixSettingsModal.ts b/src/components/modals/prefixSettingsModal.ts index 4b2b04d..4ea3ed7 100644 --- a/src/components/modals/prefixSettingsModal.ts +++ b/src/components/modals/prefixSettingsModal.ts @@ -6,7 +6,7 @@ import type Amayo from '../../core/client'; export default { customId: "prefixsettingsmodal", run: async (interaction: ModalSubmitInteraction, client: Amayo) => { - const newPrefix = interaction.fields.getTextInputValue("prefixInput"); + const newPrefix = interaction.components.getTextInputValue("prefixInput"); if (!newPrefix || newPrefix.length > 10) { return interaction.reply({