diff --git a/README.md b/README.md index 124f4b80..d7bb5694 100644 --- a/README.md +++ b/README.md @@ -118,7 +118,7 @@ don't grant that permission. ## Commands -Total: 373 +Total: 374 ### Utility: @@ -551,6 +551,7 @@ Total: 373 * **generate-commands:** Generates the commands list for Xiao's README. (Owner-Only) * **generate-credit:** Generates the credit list for Xiao's README. (Owner-Only) +* **generate-process-env:** Generates a backup list of Xiao's `process.env`. (Owner-Only) ## Licensing diff --git a/commands/readme/generate-process-env.js b/commands/readme/generate-process-env.js new file mode 100644 index 00000000..63593605 --- /dev/null +++ b/commands/readme/generate-process-env.js @@ -0,0 +1,28 @@ +const Command = require('../../structures/Command'); +const fs = require('fs'); +const path = require('path'); + +module.exports = class GenerateProcessEnvCommand extends Command { + constructor(client) { + super(client, { + name: 'generate-process-env', + aliases: ['gen-process-env', 'generate-env', 'gen-env'], + group: 'readme', + memberName: 'generate-commands', + description: 'Generates a backup list of Xiao\'s `process.env`.', + details: 'Only the bot owner(s) may use this command.', + ownerOnly: true, + guarded: true + }); + } + + run(msg) { + const data = fs.readFileSync(path.join(__dirname, '..', '..', '.env.example')).split('\n'); + const list = data.map(line => { + if (!line) return ''; + if (line.startsWith('#')) return line; + return `${line}"${process.env[line.replace('=', '')]}"`; + }).join('\n'); + return msg.channel.send({ files: [{ attachment: Buffer.from(list), name: 'provess.env.txt' }] }); + } +}; diff --git a/package.json b/package.json index c186c922..67556d1d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "112.12.8", + "version": "112.13.0", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": {