diff --git a/bot/assets/constants/exitQuotes.json b/bot/assets/constants/exitQuotes.json new file mode 100644 index 0000000..995aced --- /dev/null +++ b/bot/assets/constants/exitQuotes.json @@ -0,0 +1,10 @@ +{ + "quotes": [ + "Shutting down.", + "I don\"t blame you.", + "I don\"t hate you.", + "Whyyyyy", + "Goodnight.", + "Goodbye" + ] +} \ No newline at end of file diff --git a/bot/assets/constants/index.js b/bot/assets/constants/index.js index d7d5f95..eec3430 100644 --- a/bot/assets/constants/index.js +++ b/bot/assets/constants/index.js @@ -3,5 +3,6 @@ module.exports = { colours: require('./colours.json'), emojis: require('./emojis.json'), categories: require('./categories.json'), - replies: require ('./replies.json') + replies: require('./replies.json'), + exitQuotes: require('./exitQuotes.json').quotes }; \ No newline at end of file diff --git a/bot/commands/Developer/restart.js b/bot/commands/Developer/restart.js index 2cec35c..4247ef2 100644 --- a/bot/commands/Developer/restart.js +++ b/bot/commands/Developer/restart.js @@ -1,3 +1,5 @@ +const fetch = require('node-fetch'); + module.exports = class { constructor (name, category) { this.name = name, @@ -17,6 +19,15 @@ module.exports = class { } run (client, message, args, data) { //eslint-disable-line no-unused-vars + client.logger.success('RESTART', 'Restart command recieved. ' + client.constants.exitQuotes.random()); + client.disconnect(); + client.functions.wait(); + 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}` } + }); + //-H 'Authorization: Bearer ' -H "Content-Type: application/json" -d '{"signal": "restart"}' } }; \ No newline at end of file