generate-process-env Owner Command

This commit is contained in:
Dragon Fire
2020-03-23 11:58:27 -04:00
parent 9745b15e57
commit 8e3d9f3713
3 changed files with 31 additions and 2 deletions
+2 -1
View File
@@ -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
+28
View File
@@ -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' }] });
}
};
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiao",
"version": "112.12.8",
"version": "112.13.0",
"description": "Your personal server companion.",
"main": "Xiao.js",
"scripts": {