Files
xiao/commands/util/shutdown.js
T
2020-06-10 14:38:14 -04:00

41 lines
965 B
JavaScript

const Command = require('../../structures/Command');
const texts = require('../../assets/json/shutdown');
module.exports = class ShutdownCommand extends Command {
constructor(client) {
super(client, {
name: 'shutdown',
aliases: ['die', 'restart', 'process.exit'],
group: 'util',
memberName: 'shutdown',
description: 'Shuts down the bot.',
details: 'Only the bot owner(s) may use this command.',
guarded: true,
ownerOnly: true,
args: [
{
key: 'code',
prompt: 'What code do you want to send to `process.exit`?',
type: 'integer',
default: 0
}
]
});
}
async run(msg, { code }) {
try {
this.uses++;
this.client.exportCommandLeaderboard();
this.client.logger.info('[SHUTDOWN] Manual shutdown engaged.');
const text = texts[Math.floor(Math.random() * texts.length)];
await msg.say(text);
process.exit(code);
return null;
} catch {
process.exit(code);
return null;
}
}
};