mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-06 14:20:51 +02:00
generate-process-env Owner Command
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xiao",
|
||||
"version": "112.12.8",
|
||||
"version": "112.13.0",
|
||||
"description": "Your personal server companion.",
|
||||
"main": "Xiao.js",
|
||||
"scripts": {
|
||||
|
||||
Reference in New Issue
Block a user