import { GuildMember, Message } from 'discord.js'; import { commands } from '..'; import { Argument } from '../argument'; import { Command } from '../command'; export class HelpCommand extends Command { public name(): string { return 'help'; } public description(): string { return 'Help about a command'; } public arguments(): Array { return [ { name: 'command', type: 'string', description: 'The command to get help about' } ]; } public async permitted(member: GuildMember): Promise { return true; } public async handle(message: Message, args: Array): Promise { const [ commandName ] = args; if (!commandName) { message.channel.send(this.help()); return; } for (const command of commands) { if (command.name().toLowerCase() === commandName.toLowerCase()) { message.channel.send(command.help()); return; } } } }