From a2f46051e19205aeb579b1c680f2856825e7409a Mon Sep 17 00:00:00 2001 From: Emily J Date: Thu, 29 Oct 2020 20:16:41 +1100 Subject: [PATCH] working restart command --- src/commands/restart.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/commands/restart.js b/src/commands/restart.js index f3cf1a7..3731fe6 100644 --- a/src/commands/restart.js +++ b/src/commands/restart.js @@ -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 = {