1234567891011121314151617181920212223242526272829 |
- 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);
- }
- }
|