1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
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' }] })
}
};
|