From 8ca7a6ffc85e4a76dad021279fd0b665e7eee753 Mon Sep 17 00:00:00 2001 From: Dragon Fire Date: Sat, 21 Mar 2020 17:50:18 -0400 Subject: [PATCH] Use txt files in README generator commands --- README.md | 3 --- commands/readme/generate-commands.js | 17 +++-------------- commands/readme/generate-credit.js | 16 +++------------- package.json | 2 +- 4 files changed, 7 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index 0c5e277a..5347cc57 100644 --- a/README.md +++ b/README.md @@ -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/) diff --git a/commands/readme/generate-commands.js b/commands/readme/generate-commands.js index 0678af58..ee729708 100644 --- a/commands/readme/generate-commands.js +++ b/commands/readme/generate-commands.js @@ -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' }] }); } }; diff --git a/commands/readme/generate-credit.js b/commands/readme/generate-credit.js index b7e069b6..dd953b36 100644 --- a/commands/readme/generate-credit.js +++ b/commands/readme/generate-credit.js @@ -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' }] }); } }; diff --git a/package.json b/package.json index 54150695..db8d320c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "112.12.0", + "version": "112.12.1", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": {