blob: 36338dc3da40497b912c5b24f1992a79bde9ce56 [file] [log] [blame]
pineafan377794f2022-04-18 19:01:01 +01001import Discord, { CommandInteraction } from "discord.js";
pineafan4f164f32022-02-26 22:07:12 +00002import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
3import { WrappedCheck } from "jshaiku";
pineafan377794f2022-04-18 19:01:01 +01004import confirmationMessage from "../../utils/confirmationMessage.js";
5import generateEmojiEmbed from "../../utils/generateEmojiEmbed.js";
pineafan4f164f32022-02-26 22:07:12 +00006
7const command = (builder: SlashCommandSubcommandBuilder) =>
8 builder
9 .setName("suggest")
10 .setDescription("Sends a suggestion to the developers")
pineafan377794f2022-04-18 19:01:01 +010011 .addStringOption(option => option.setName("suggestion").setDescription("The suggestion to send").setRequired(true))
pineafan4f164f32022-02-26 22:07:12 +000012
pineafan377794f2022-04-18 19:01:01 +010013const callback = async (interaction: CommandInteraction) => {
14 // @ts-ignore
15 const { renderUser } = interaction.client.logger
16 let suggestion = interaction.options.getString("suggestion");
17 let confirmation = await new confirmationMessage(interaction)
18 .setEmoji("ICONS.OPP.ADD")
19 .setTitle("Suggest")
20 .setDescription(`**Suggestion:**\n> ${suggestion}\n`
21 + `Your username and ID will also be sent with your suggestion.\n\nAre you sure you want to send this suggestion?`)
22 .setColor("Danger")
23 .send()
24 if (confirmation.success) {
25 await (interaction.client.channels.cache.get('955161206459600976') as Discord.TextChannel).send({
26 embeds: [
27 new generateEmojiEmbed()
28 .setTitle(`Suggestion`)
29 .setDescription(`**From:** ${renderUser(interaction.member.user)}\n**Suggestion:**\n> ${suggestion}`)
30 .setStatus("Danger")
31 .setEmoji("NUCLEUS.LOGO")
32 ]
33 })
34 await interaction.editReply({embeds: [new generateEmojiEmbed()
35 .setEmoji("ICONS.ADD")
36 .setTitle(`Suggest`)
37 .setDescription("Your suggestion was sent successfully")
38 .setStatus("Success")
39 ], components: []})
40 } else {
41 await interaction.editReply({embeds: [new generateEmojiEmbed()
42 .setEmoji("ICONS.OPP.ADD")
43 .setTitle(`Suggest`)
44 .setDescription("No changes were made")
45 .setStatus("Danger")
46 ], components: []})
47 }
pineafan4f164f32022-02-26 22:07:12 +000048}
49
50const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
51 return true;
52}
53
54export { command };
55export { callback };
56export { check };