mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-08 15:19:14 +02:00
Filter stuff out of generate-commands
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
const Command = require('../../structures/Command');
|
||||
|
||||
module.exports = class HelloWorldCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'hello-world',
|
||||
group: 'single',
|
||||
memberName: 'hello-world',
|
||||
description: 'Hello world!'
|
||||
});
|
||||
}
|
||||
|
||||
run(msg) {
|
||||
return msg.say('Hello, world!');
|
||||
}
|
||||
};
|
||||
@@ -7,7 +7,7 @@ module.exports = class GenerateCommandsCommand extends Command {
|
||||
aliases: ['gen-commands', 'generate-cmds', 'gen-cmds'],
|
||||
group: 'util',
|
||||
memberName: 'generate-commands',
|
||||
description: 'Generates the commands list for Xiao\'s README.',
|
||||
description: 'Generates the commands list as a TXT file.',
|
||||
details: 'Only the bot owner(s) may use this command.',
|
||||
ownerOnly: true,
|
||||
guarded: true
|
||||
@@ -17,12 +17,11 @@ module.exports = class GenerateCommandsCommand extends Command {
|
||||
async run(msg) {
|
||||
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 commands = g.commands.filter(c => !c.hidden && !c.ownerOnly && !c.nsfw);
|
||||
if (!commands.size) return null;
|
||||
return `\n### ${g.name}:\n\n${commands.map(c => `* **${c.name}:** ${c.description}`).join('\n')}`;
|
||||
})
|
||||
.filter(cmds => cmds);
|
||||
const text = `Total: ${this.client.registry.commands.size}\n${list.join('\n')}`;
|
||||
await msg.direct({ files: [{ attachment: Buffer.from(text), name: 'commands.txt' }] });
|
||||
return msg.say('📬 Sent `commands.txt` to your DMs!');
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xiao",
|
||||
"version": "132.10.0",
|
||||
"version": "132.11.0",
|
||||
"description": "Your personal server companion.",
|
||||
"main": "Xiao.js",
|
||||
"scripts": {
|
||||
|
||||
Reference in New Issue
Block a user