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

33 lines
1.1 KiB
JavaScript
Raw Normal View History

2020-10-29 09:28:00 +00:00
const fetch = require('node-fetch');
2020-11-10 03:31:49 +00:00
const exitQuotes = require('../../assets/exitQuotes.json');
2020-10-29 09:28:00 +00:00
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-11-10 03:31:49 +00:00
client.logger.success('RESTART', 'Restart command recieved. ' + exitQuotes.random());
2020-10-29 09:28:00 +00:00
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}`, 'User-Agent': client.config.userAgent }
2020-10-29 09:28:00 +00:00
});
2020-10-29 08:31:05 +00:00
}
};