import { Command, CommandoMessage } from 'discord.js-commando'; module.exports = class GenerateCommandsBot extends Command { constructor(client) { super(client, { name: 'generatecommands', aliases: [ 'generate-commands', 'generatecmds', 'generate-cmds', 'gencommands', 'gen-commands', 'gencmds', 'gen-cmds' ], group: 'bot', memberName: 'generatecommands', description: 'Generates a .txt file with all of the available commands.', examples: ['uwu!gencmds'], userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], throttling: { usages: 5, duration: 30 }, ownerOnly: true, guarded: true }); } async run(msg: CommandoMessage) { const list = this.client.registry.groups .map(g => { const commands = g.commands.filter(c => !c.hidden) return `\n### ${g.name}\n\n${commands.map(c => { const extra = `${c.ownerOnly ? ' (Owner-Only)' : ''}${c.nsfw ? ' (NSFW)' : ''}` return `* ** ${c.name}:** ${c.description}${extra}` }).join('\n')}` }) const text = `Total: ${this.client.registry.commands.size}\n${list.join('\n')}` return msg.reply({ files: [{ attachment: Buffer.from(text), name: 'commands.txt' }] }) } };