woomy/src/commands/restart.js

33 lines
863 B
JavaScript
Raw Normal View History

2020-10-29 09:16:41 +00:00
const fetch = require('node-fetch');
exports.run = (client, message) => {// eslint-disable-line no-unused-vars
2020-03-09 01:11:33 +00:00
// This actually shuts down the bot, you'll need to use something like pm2 to get it to restart
2020-10-29 09:16:41 +00:00
message.channel.send("<:reboot:467216876938985482> Restarting...");
client.destroy();
2020-10-29 09:23:34 +00:00
require("util").promisify(setTimeout);
2020-03-09 01:11:33 +00:00
2020-10-29 09:16:41 +00:00
fetch('https://gamecp.apex.to/api/client/servers/1fc76afa-9a4d-497b-983a-a898795ab5b5/power', {
method: 'post',
2020-10-29 09:23:34 +00:00
body: JSON.stringify({ 'signal': 'restart' }),
headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${client.config.server}` }
2020-01-25 10:02:43 +00:00
});
};
exports.conf = {
enabled: true,
guildOnly: false,
aliases: [],
permLevel: "Developer",
requiredPerms: []
};
exports.help = {
name: "restart",
category: "Owner",
description: "Restarts the bot.",
usage: "restart"
};