mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Add commands to help with readme building
This commit is contained in:
@@ -33,7 +33,8 @@ client.registry
|
||||
['number-edit', 'Number Manipulation'],
|
||||
['nsfw', 'NSFW'],
|
||||
['other', 'Other'],
|
||||
['roleplay', 'Roleplay']
|
||||
['roleplay', 'Roleplay'],
|
||||
['owner', 'Owner-Only']
|
||||
])
|
||||
.registerDefaultCommands({
|
||||
help: false,
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const request = require('node-superfetch');
|
||||
|
||||
module.exports = class GenerateCommandsCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'generate-commands',
|
||||
aliases: ['gen-commands'],
|
||||
group: 'owner',
|
||||
memberName: 'generate-commands',
|
||||
description: 'Generates the commands list for Xiao\'s README.',
|
||||
ownerOnly: true,
|
||||
guarded: true
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg) {
|
||||
const list = client.registry.groups
|
||||
.filter(g => g.id !== 'owner')
|
||||
.map(g => `\n### ${g.name}:\n\n${g.commands.map(c => `* **${c.name}:** ${c.description}`).join('\n')}`);
|
||||
const { body } = await request
|
||||
.post('https://hastebin.com/documents')
|
||||
.send(list.join('\n'));
|
||||
return msg.say(`https://hastebin.com/raw/${body.key}`);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,37 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const request = require('node-superfetch');
|
||||
|
||||
module.exports = class GenerateCreditCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'generate-credit',
|
||||
aliases: ['gen-credit'],
|
||||
group: 'owner',
|
||||
memberName: 'generate-credit',
|
||||
description: 'Generates the credit list for Xiao\'s README.',
|
||||
ownerOnly: true,
|
||||
guarded: true
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg) {
|
||||
const credit = [];
|
||||
const commands = client.registry.commands.filter(cmd => cmd.credit && cmd.credit.length > 1);
|
||||
for (const command of commands) {
|
||||
for (const credit of command.credit) {
|
||||
const found = credit.find(c => c.name === credit.name);
|
||||
if (found) {
|
||||
found.commands.push(command.name);
|
||||
continue;
|
||||
};
|
||||
if (credit.name === 'Dragon Fire') continue;
|
||||
credit.push({ ...credit, commands: [command.name] });
|
||||
}
|
||||
}
|
||||
const mapped = credit.map(c => `- [${c.name}](${c.url})\n${c.commands.map(cmd => ` * ${cmd}`).join('\n')}`);
|
||||
const { body } = await request
|
||||
.post('https://hastebin.com/documents')
|
||||
.send(mapped.join('\n'));
|
||||
return msg.say(`https://hastebin.com/raw/${body.key}`);
|
||||
}
|
||||
};
|
||||
@@ -29,6 +29,7 @@ module.exports = class HelpCommand extends Command {
|
||||
.setColor(0x00AE86)
|
||||
.setFooter(`${this.client.registry.commands.size} Commands`);
|
||||
for (const group of this.client.registry.groups.values()) {
|
||||
if (group.id === 'owner') continue;
|
||||
embed.addField(
|
||||
`❯ ${group.name}`,
|
||||
group.commands.map(cmd => `\`${cmd.name}\``).join(', ') || 'None'
|
||||
|
||||
Reference in New Issue
Block a user