working restart command

This commit is contained in:
Emily 2020-10-29 20:16:41 +11:00
parent 00196b201d
commit a2f46051e1
1 changed files with 11 additions and 6 deletions

View File

@ -1,14 +1,19 @@
exports.run = async (client, message) => {// eslint-disable-line no-unused-vars
const fetch = require('node-fetch');
exports.run = (client, message) => {// eslint-disable-line no-unused-vars
// This actually shuts down the bot, you'll need to use something like pm2 to get it to restart
await message.channel.send("<:reboot:467216876938985482> Restarting...");
message.channel.send("<:reboot:467216876938985482> Restarting...");
client.destroy();
client.wait();
client.commands.forEach( async cmd => {
await client.unloadCommand(cmd);
fetch('https://gamecp.apex.to/api/client/servers/1fc76afa-9a4d-497b-983a-a898795ab5b5/power', {
method: 'post',
body: { 'signal': 'restart' },
headers: { 'Authorization': `Bearer ${client.config.server}` }
});
process.exit();
};
exports.conf = {