From b832a4c390291414f30ffca0d23e7714697d89dd Mon Sep 17 00:00:00 2001 From: Lio Young Date: Sat, 24 Apr 2021 17:42:07 +0200 Subject: [PATCH] add suggestion command --- src/modules/general/suggestion.ts | 30 ++++++++++++++++++++++++++++++ tsconfig.json | 10 +++++++++- 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 src/modules/general/suggestion.ts diff --git a/src/modules/general/suggestion.ts b/src/modules/general/suggestion.ts new file mode 100644 index 0000000..e293a4d --- /dev/null +++ b/src/modules/general/suggestion.ts @@ -0,0 +1,30 @@ +import yiff from '../../utils/yiff'; +import Command from '../../handler/structures/Command'; +import { Context } from '../../utils/types'; +import SendWS from "../../utils/webhook"; +import lingua from '../../utils/lingua'; +import { suggest } from '../../utils/trello'; +export = class Fox extends Command { + constructor() { + super({ + name: "suggest", + description: "Suggest a Feature!", + aliases: ["suggestion"], + cooldown: 10, + }) + } + + async command(ctx: Context) { + const [title, desc] = ctx.args.join(" ").split("|").map(v => v.trim()); + // @ts-ignore + if (!title) return ctx.channel.send(lingua[ctx.settings.locale].MISSING_TITLE) + let author = `${ctx.author.tag} (${ctx.author.id})` + let guild = `${ctx.guild?.name} (${ctx.guild?.id})` + + await suggest({ title, desc, author, guild }) + if (ctx.config?.webhook?.suggestions) await SendWS(ctx.config.webhook.suggestions, { title, desc, ctx }) + + // @ts-ignore + ctx.channel.send(lingua[ctx.settings.locale].SUGGESTION_SENT) + } +} \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index 4dfd174..1401bf3 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -22,5 +22,13 @@ "declaration": true }, "include": ["**/*"], - "exclude": ["node_modules", "build", "out", "tmp", "logs", "test"] + "exclude": [ + "node_modules", + "build", + "out", + "tmp", + "logs", + "test", + "sample.config.ts" + ] }