Use txt files in README generator commands

This commit is contained in:
Dragon Fire
2020-03-21 17:50:18 -04:00
parent be993179a7
commit 8ca7a6ffc8
4 changed files with 7 additions and 31 deletions
-3
View File
@@ -724,9 +724,6 @@ here.
* brony-speak ([Original "My Little Pony: Friendship is Magic" Show](https://mylittlepony.hasbro.com/en-us))
* connect-four (Original "Connect Four" Game)
* scrabble-score ([Original Scrabble Game](https://scrabble.hasbro.com/en-us))
- [Hastebin](https://hastebin.com/about.md)
* generate-commands (API)
* generate-credit (API)
- [Horst Faas](https://en.wikipedia.org/wiki/Horst_Faas)
* vietnam-flashbacks (Image)
- [HTTP Cats](https://http.cat/)
+3 -14
View File
@@ -1,5 +1,4 @@
const Command = require('../../structures/Command');
const request = require('node-superfetch');
module.exports = class GenerateCommandsCommand extends Command {
constructor(client) {
@@ -11,25 +10,15 @@ module.exports = class GenerateCommandsCommand extends Command {
description: 'Generates the commands list for Xiao\'s README.',
details: 'Only the bot owner(s) may use this command.',
ownerOnly: true,
guarded: true,
credit: [
{
name: 'Hastebin',
url: 'https://hastebin.com/about.md',
reason: 'API'
}
]
guarded: true
});
}
async run(msg) {
run(msg) {
const list = this.client.registry.groups
.map(g => `\n### ${g.name}:\n\n${g.commands.filter(c => !c.hidden).map(
c => `* **${c.name}:** ${c.description}${c.ownerOnly ? ' (Owner-Only)' : ''}${c.nsfw ? ' (NSFW)' : ''}`
).join('\n')}`);
const { body } = await request
.post('https://hastebin.com/documents')
.send(`Total: ${this.client.registry.commands.size}\n${list.join('\n')}`);
return msg.say(`https://hastebin.com/raw/${body.key}`);
return msg.channel.send({ files: [{ attachment: Buffer.from(list), name: 'commands.txt' }] });
}
};
+3 -13
View File
@@ -12,18 +12,11 @@ module.exports = class GenerateCreditCommand extends Command {
description: 'Generates the credit list for Xiao\'s README.',
details: 'Only the bot owner(s) may use this command.',
ownerOnly: true,
guarded: true,
credit: [
{
name: 'Hastebin',
url: 'https://hastebin.com/about.md',
reason: 'API'
}
]
guarded: true
});
}
async run(msg) {
run(msg) {
let credit = [];
for (const command of this.client.registry.commands.values()) {
if (!command.credit || command.credit.length <= 1) continue;
@@ -55,9 +48,6 @@ module.exports = class GenerateCreditCommand extends Command {
if (!cmd.reasonURL) return ` * ${cmd.name} (${cmd.reason})`;
return ` * ${cmd.name} ([${cmd.reason}](${cmd.reasonURL}))`;
}).join('\n')}`);
const { body } = await request
.post('https://hastebin.com/documents')
.send(mapped.join('\n'));
return msg.say(`https://hastebin.com/raw/${body.key}`);
return msg.channel.send({ files: [{ attachment: Buffer.from(mapped), name: 'credit.txt' }] });
}
};
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiao",
"version": "112.12.0",
"version": "112.12.1",
"description": "Your personal server companion.",
"main": "Xiao.js",
"scripts": {