import { isAuthorisedAsync } from "../util"; import { CommandSet, Command } from "src/model/command"; import { Message } from "discord.js"; import { getDocumentation } from "src/main"; @CommandSet export class Help { @Command({ pattern: "help" }) async showHelp(msg: Message) { let isAuthed = await isAuthorisedAsync(msg.member); let baseCommands = "\n"; let modCommands = "\n"; for (let doc of getDocumentation()) { if (isAuthed && doc.auth) modCommands = `${modCommands}${doc.example} - ${doc.doc}\n`; else if (!doc.auth) baseCommands = `${baseCommands}${doc.example} - ${doc.doc}\n`; } let message = `Hello! I am NoctBot! My job is to help with C(O)M-related problems!\nPing me with one of the following commands:\n\`\`\`${baseCommands}\`\`\``; if (isAuthed) message = `${msg.author.toString()} ${message}\nšŸ‘‘**Moderator commands**šŸ‘‘\n\`\`\`${modCommands}\`\`\``; msg.channel.send(message); } }