diff --git a/SuggestCommandPlugin/README.md b/SuggestCommandPlugin/README.md new file mode 100644 index 0000000..6b3d3f0 --- /dev/null +++ b/SuggestCommandPlugin/README.md @@ -0,0 +1,11 @@ +# Suggestion Command +This plugin lets you make suggestion command. + +## Setup +* Copy the contents of the `suggest.ts` file into a new file with this path in your bot: `src/commands/information/suggestion.ts`. +* Update line 27 with the ID of your channel and make `suggest.ts` file inside `src/commands/information`. +* You can delete the line 47 if you doesn't want to add Threads. + +* If you found some bug let me know it. + +Aurora_Jack#5330 diff --git a/SuggestCommandPlugin/suggest.ts b/SuggestCommandPlugin/suggest.ts new file mode 100644 index 0000000..b5de1cd --- /dev/null +++ b/SuggestCommandPlugin/suggest.ts @@ -0,0 +1,66 @@ +import { CommandContext } from '../../structures/addons/CommandAddons'; +import { Command } from '../../structures/Command'; +import { TextChannel } from 'discord.js'; +import { checkIconUrl, greenColor, mainColor } from '../../handlers/locale'; +import { discordClient } from '../../main'; + +class SuggestionCommand extends Command { + constructor() { + super({ + trigger: "suggest", + description: "Suggest a suggestion.", + type: "ChatInput", + module: "utilities", + args: [ + { + trigger: 'suggestion', + description: 'Say here what you wanna suggest.', + isLegacyFlag: false, + required: true, + type: 'String', + } + ] + }); + } + + async run(ctx: CommandContext) { + const channel = await discordClient.channels.fetch('YOUR SUGGESTION CHANNEL') as TextChannel; + channel.send({ + embeds: [ + { + author: { + name: 'Suggestion', + }, + description: (ctx.args['suggestion']), + color: mainColor, + timestamp: new Date(), + footer: { + text: `Suggested by: ${ctx.user.tag}`, + iconURL: ctx.user.displayAvatarURL({dynamic: true}) + }, + } + ] + }).then(sentMessage => { + sentMessage + .react('👍') + .react('🤷') + .react('👎') + .startThread({ name: 'Suggestion', autoArchiveDuration: 1440, reason: 'Because someone send a suggestion.' }) + }).catch(console.error); + + return ctx.reply({ + embeds: [ + { + author: { + name: 'Success!', + iconURL: checkIconUrl, + }, + description: 'Your suggestion has been sent successfully!', + color: greenColor, + } + ] + }) + } + } + +export default SuggestionCommand;