woomy-v2/bot/commands/Developer/restart.js

32 lines
1.1 KiB
JavaScript
Raw Normal View History

2020-10-29 09:28:00 +00:00
const fetch = require('node-fetch');
2020-10-29 08:31:05 +00:00
module.exports = class {
constructor (name, category) {
this.name = name,
this.category = category,
this.enabled = true,
this.devOnly = true,
this.aliases = ['reboot'],
this.userPerms = [],
this.botPerms = [],
this.cooldown = 0,
this.help = {
description: 'Restarts Woomy.',
arguments: '',
details: '',
examples: ''
};
}
run (client, message, args, data) { //eslint-disable-line no-unused-vars
2020-10-29 09:28:00 +00:00
client.logger.success('RESTART', 'Restart command recieved. ' + client.constants.exitQuotes.random());
client.disconnect();
client.functions.wait();
2020-10-29 08:31:05 +00:00
2020-10-29 09:28:00 +00:00
fetch('https://gamecp.apex.to/api/client/servers/1fc76afa-9a4d-497b-983a-a898795ab5b5/power', {
method: 'post',
body: JSON.stringify({ 'signal': 'restart' }),
headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${client.config.server}` }
});
2020-10-29 08:31:05 +00:00
}
};