mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-27 06:37:32 +02:00
bot list gen-commands
This commit is contained in:
@@ -10,15 +10,27 @@ module.exports = class GenerateCommandsCommand extends Command {
|
|||||||
description: 'Generates the commands list for Xiao\'s README.',
|
description: 'Generates the commands list for Xiao\'s README.',
|
||||||
details: 'Only the bot owner(s) may use this command.',
|
details: 'Only the bot owner(s) may use this command.',
|
||||||
ownerOnly: true,
|
ownerOnly: true,
|
||||||
guarded: true
|
guarded: true,
|
||||||
|
args: [
|
||||||
|
{
|
||||||
|
key: 'botList',
|
||||||
|
prompt: 'Do you want to generate the bot list version of the command list?',
|
||||||
|
type: 'boolean',
|
||||||
|
default: false
|
||||||
|
}
|
||||||
|
]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
run(msg) {
|
run(msg, { botList }) {
|
||||||
const list = this.client.registry.groups
|
const list = this.client.registry.groups
|
||||||
.map(g => `\n### ${g.name}:\n\n${g.commands.filter(c => !c.hidden).map(
|
.map(g => {
|
||||||
c => `* **${c.name}:** ${c.description}${c.ownerOnly ? ' (Owner-Only)' : ''}${c.nsfw ? ' (NSFW)' : ''}`
|
const commands = g.commands.filter(c => !c.hidden && (botList ? !c.ownerOnly && !c.nsfw : true));
|
||||||
).join('\n')}`);
|
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')}`;
|
const text = `Total: ${this.client.registry.commands.size}\n${list.join('\n')}`;
|
||||||
return msg.channel.send({ files: [{ attachment: Buffer.from(text), name: 'commands.txt' }] });
|
return msg.channel.send({ files: [{ attachment: Buffer.from(text), name: 'commands.txt' }] });
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user