import { Modal, Slash, execute } from 'sunar';
import {
ActionRowBuilder,
ModalBuilder,
TextInputBuilder,
TextInputStyle,
} from 'discord.js';
const slash = new Slash({
name: 'feedback',
description: 'Send us feedback',
});
execute(slash, (interaction) => {
const contentInput = new TextInputBuilder()
.setCustomId('content')
.setLabel('Content')
.setStyle(TextInputStyle.Paragraph)
.setPlaceholder('Your feedback content...')
.setRequired(true);
const row = new ActionRowBuilder().setComponents(contentInput);
const modal = new ModalBuilder()
.setCustomId('feedback')
.setTitle('Submit your feedback')
.setComponents(row);
interaction.showModal(modal);
});
const modal = new Modal({ id: 'feedback' });
execute(modal, (interaction) => {
const feedback = interaction.fields.getTextInputValue('content');
// Send feedback somewhere...
interaction.reply({
content: 'Thanks for the feedback!',
ephemeral: true,
});
});
export { slash, modal };