Export to dm in owner only stuff

This commit is contained in:
Dragon Fire
2020-06-07 18:13:08 -04:00
parent 2265bd1dca
commit 9841a4db16
6 changed files with 16 additions and 10 deletions
@@ -22,8 +22,9 @@ module.exports = class CommandLeaderboardExportCommand extends Command {
});
}
run(msg) {
async run(msg) {
const result = this.client.exportCommandLeaderboard();
return msg.say({ files: [{ attachment: result, name: 'command-leaderboard.json' }] });
await msg.direct({ files: [{ attachment: result, name: 'command-leaderboard.json' }] });
return msg.say('📬 Sent \`command-leaderboard.json\` to your DMs!');
}
};
+3 -2
View File
@@ -14,7 +14,7 @@ module.exports = class GenerateCommandsCommand extends Command {
});
}
run(msg) {
async run(msg) {
const list = this.client.registry.groups
.map(g => {
const commands = g.commands.filter(c => !c.hidden);
@@ -24,6 +24,7 @@ module.exports = class GenerateCommandsCommand extends Command {
}).join('\n')}`;
});
const text = `Total: ${this.client.registry.commands.size}\n${list.join('\n')}`;
return msg.say({ files: [{ attachment: Buffer.from(text), name: 'commands.txt' }] });
await msg.direct({ files: [{ attachment: Buffer.from(text), name: 'commands.txt' }] });
return msg.say('📬 Sent \`commands.txt\` to your DMs!');
}
};
+3 -2
View File
@@ -15,7 +15,7 @@ module.exports = class GenerateCreditCommand extends Command {
});
}
run(msg) {
async run(msg) {
let credit = [];
for (const command of this.client.registry.commands.values()) {
if (!command.credit || command.credit.length <= 1) continue;
@@ -47,6 +47,7 @@ module.exports = class GenerateCreditCommand extends Command {
if (!cmd.reasonURL) return ` * ${cmd.name} (${cmd.reason})`;
return ` * ${cmd.name} (${embedURL(cmd.reason, cmd.reasonURL || '', false)})`;
}).join('\n')}`);
return msg.say({ files: [{ attachment: Buffer.from(mapped.join('\n')), name: 'credit.txt' }] });
await msg.direct({ files: [{ attachment: Buffer.from(mapped.join('\n')), name: 'credit.txt' }] });
return msg.say('📬 Sent \`credit.txt\` to your DMs!');
}
};
+4 -2
View File
@@ -1,6 +1,7 @@
const Command = require('../../structures/Command');
const fs = require('fs');
const path = require('path');
const { verify } = require('../../util/Util');
module.exports = class GenerateProcessEnvCommand extends Command {
constructor(client) {
@@ -16,7 +17,7 @@ module.exports = class GenerateProcessEnvCommand extends Command {
});
}
run(msg) {
async run(msg) {
const data = fs.readFileSync(path.join(__dirname, '..', '..', '.env.example'), { encoding: 'utf8' });
const list = data.split('\n').map(line => {
if (!line) return '';
@@ -24,6 +25,7 @@ module.exports = class GenerateProcessEnvCommand extends Command {
line = line.replace('=', '');
return `${line}="${process.env[line] || ''}"`;
}).join('\n');
return msg.say({ files: [{ attachment: Buffer.from(list), name: 'process.env.txt' }] });
await msg.direct({ files: [{ attachment: Buffer.from(list), name: 'process.env.txt' }] });
return msg.say('📬 Sent \`process.env.txt\` to your DMs!');
}
};
+2 -1
View File
@@ -22,10 +22,11 @@ module.exports = class ShutdownCommand extends Command {
});
}
run(msg, { code }) {
async run(msg, { code }) {
this.uses++;
this.client.exportCommandLeaderboard();
this.client.logger.info('[SHUTDOWN] Manual shutdown engaged.');
await msg.say('Shutting down... :(');
process.exit(code);
return null;
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiao",
"version": "116.3.0",
"version": "116.3.1",
"description": "Your personal server companion.",
"main": "Xiao.js",
"scripts": {