restart command wip
This commit is contained in:
		
							parent
							
								
									5d15d6df9d
								
							
						
					
					
						commit
						19fc7ceb58
					
				
					 3 changed files with 23 additions and 1 deletions
				
			
		
							
								
								
									
										10
									
								
								bot/assets/constants/exitQuotes.json
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								bot/assets/constants/exitQuotes.json
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,10 @@
 | 
			
		|||
{
 | 
			
		||||
    "quotes": [
 | 
			
		||||
        "Shutting down.",
 | 
			
		||||
        "I don\"t blame you.",
 | 
			
		||||
        "I don\"t hate you.",
 | 
			
		||||
        "Whyyyyy",
 | 
			
		||||
        "Goodnight.",
 | 
			
		||||
        "Goodbye"
 | 
			
		||||
    ]
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
};
 | 
			
		||||
| 
						 | 
				
			
			@ -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 <snip>' -H "Content-Type: application/json" -d '{"signal": "restart"}'
 | 
			
		||||
    }
 | 
			
		||||
};
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue