mirror of https://github.com/thaldrin/thaldrin.git
add bugreport command
This commit is contained in:
parent
09d489b923
commit
7dda54d70d
|
@ -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))
|
||||
}
|
||||
}
|
|
@ -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))
|
||||
}
|
||||
}
|
|
@ -1 +1 @@
|
|||
Subproject commit f7702694fb301a07b1aa16f34e61229fc56a059b
|
||||
Subproject commit 192733a965a7572289f7ace05a1ee9a724052000
|
|
@ -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
|
Loading…
Reference in New Issue