diff --git a/src/modules/misc/bug.ts b/src/modules/misc/bug.ts new file mode 100644 index 0000000..a4f5506 --- /dev/null +++ b/src/modules/misc/bug.ts @@ -0,0 +1,30 @@ +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'; +import replace from '../../utils/replace'; +export = class Suggestion extends Command { + constructor() { + super({ + name: "bug", + description: "Report a Bug", + aliases: ["bugreport"], + 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?.bug) await SendWS(ctx.config.webhook.bug, { title, desc, ctx }) + + // @ts-ignore + ctx.channel.send(replace(/VALUE/gi, "Bug Report", lingua[ctx.settings.locale].VALUE_SENT)) + } +} \ No newline at end of file diff --git a/src/modules/misc/suggestion.ts b/src/modules/misc/suggestion.ts index 0332562..ad81485 100644 --- a/src/modules/misc/suggestion.ts +++ b/src/modules/misc/suggestion.ts @@ -24,6 +24,6 @@ export = class Suggestion extends Command { 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) + ctx.channel.send(replace(/VALUE/gi, "Suggestion", lingua[ctx.settings.locale].VALUE_SENT)) } } \ No newline at end of file diff --git a/src/utils/lingua b/src/utils/lingua index f770269..192733a 160000 --- a/src/utils/lingua +++ b/src/utils/lingua @@ -1 +1 @@ -Subproject commit f7702694fb301a07b1aa16f34e61229fc56a059b +Subproject commit 192733a965a7572289f7ace05a1ee9a724052000 diff --git a/src/utils/trello.ts b/src/utils/trello.ts index 28795ab..fff71c8 100644 --- a/src/utils/trello.ts +++ b/src/utils/trello.ts @@ -25,6 +25,20 @@ export async function suggest({ title, desc, author, guild }: { title: string, d return Card } +export async function bug({ title, desc, author, guild }: { title: string, desc?: string, author: string, guild: string }) { + let Card = await Trello.addCard({ + idList: config.trello.options.list.bugs, + name: `Bug - ${title}`, + desc: ` + ${desc || title} + + Author: ${author} + Server: ${guild} + ` + }) + + return Card +} export default Trello \ No newline at end of file