diff options
| author | Andrew Lee <andrew@alee14.me> | 2025-03-08 00:11:03 -0500 |
|---|---|---|
| committer | Andrew Lee <andrew@alee14.me> | 2025-03-08 00:11:03 -0500 |
| commit | 52f8826e526f0c0aadb86c3e29975aef4dc1ab85 (patch) | |
| tree | 910308d13df0e139dd18eb10fcbb92c014d9caef /bot/src/commands/suggest.js | |
| parent | c921e5cf8862def58029bd1801074c51113f86ae (diff) | |
| download | AleeBot-52f8826e526f0c0aadb86c3e29975aef4dc1ab85.tar.gz AleeBot-52f8826e526f0c0aadb86c3e29975aef4dc1ab85.tar.bz2 AleeBot-52f8826e526f0c0aadb86c3e29975aef4dc1ab85.zip | |
Bulk delete message event; Guild suggestions; sinfo + uinfo
Diffstat (limited to 'bot/src/commands/suggest.js')
| -rw-r--r-- | bot/src/commands/suggest.js | 46 |
1 files changed, 45 insertions, 1 deletions
diff --git a/bot/src/commands/suggest.js b/bot/src/commands/suggest.js index e4bed85..7bb91e2 100644 --- a/bot/src/commands/suggest.js +++ b/bot/src/commands/suggest.js @@ -8,6 +8,7 @@ import { EmbedBuilder } from 'discord.js'; import { abEmbedColour, featureSuggestChannel } from '../storage/consts.js'; +import { guildSettings } from '../models/guild-settings.js'; export default { data: new SlashCommandBuilder() @@ -50,7 +51,7 @@ export default { new EmbedBuilder() .setTitle('AleeBot Feature Suggestion') .setDescription(`This is an AleeBot feature suggested from ${modalInteraction.user.username}.`) - .addFields({ name: 'Suggestion Contents', value: feature }) + .addFields({ name: 'Suggestion Content', value: feature }) .setColor(abEmbedColour) .setFooter({ text: `Sending from ${modalInteraction.guild.name}`, iconURL: modalInteraction.guild.iconURL() }) ]}); @@ -62,5 +63,48 @@ export default { }); } + + if (interaction.options.getSubcommand() === 'guild') { + const guildSetting = await guildSettings.findOne({ where: { guildID: interaction.guild.id } }); + if (!guildSetting || !guildSetting.suggestionsChannelID) return await interaction.reply({ content: 'This server did not configure to have suggestions enabled.' }); + + const modal = new ModalBuilder() + .setCustomId(`suggest-${interaction.user.id}`) + .setTitle(`Suggestion for ${interaction.guild.name}`); + + const featureText = new TextInputBuilder() + .setCustomId('feature') + .setLabel('Suggestion') + .setMaxLength(200) + .setPlaceholder('Feature') + .setStyle(TextInputStyle.Paragraph); + + const firstActionRow = new ActionRowBuilder().addComponents(featureText); + + modal.addComponents(firstActionRow); + + await interaction.showModal(modal); + + const filter = (interaction) => interaction.customId === `suggest-${interaction.user.id}`; + + interaction.awaitModalSubmit({ filter, time: 1000 * 1200 }) + .then(async (modalInteraction) => { + const feature = modalInteraction.fields.getTextInputValue('feature'); + + modalInteraction.client.channels.cache.get(guildSetting.suggestionsChannelID).send({ embeds: [ + new EmbedBuilder() + .setTitle('Suggestion') + .setDescription(`This is a suggestion from ${interaction.user.username}.`) + .addFields({ name: 'Suggestion Content', value: feature }) + .setColor(abEmbedColour) + ]}); + + return await modalInteraction.reply({content: 'Your suggestion has been sent.', flags: MessageFlags.Ephemeral}); + }) + .catch((err) => { + console.error(err); + }); + + } } }; |
