forked from embee/woomy
		
	working restart command
This commit is contained in:
		
							parent
							
								
									00196b201d
								
							
						
					
					
						commit
						a2f46051e1
					
				
					 1 changed files with 11 additions and 6 deletions
				
			
		| 
						 | 
					@ -1,14 +1,19 @@
 | 
				
			||||||
exports.run = async (client, message) => {// eslint-disable-line no-unused-vars
 | 
					const fetch = require('node-fetch');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					exports.run = (client, message) => {// eslint-disable-line no-unused-vars
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // This actually shuts down the bot, you'll need to use something like pm2 to get it to restart
 | 
					  // This actually shuts down the bot, you'll need to use something like pm2 to get it to restart
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  await message.channel.send("<:reboot:467216876938985482> Restarting...");
 | 
					  message.channel.send("<:reboot:467216876938985482> Restarting...");
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					  client.destroy();
 | 
				
			||||||
 | 
					  client.wait();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  client.commands.forEach( async cmd => {
 | 
					  fetch('https://gamecp.apex.to/api/client/servers/1fc76afa-9a4d-497b-983a-a898795ab5b5/power', {
 | 
				
			||||||
    await client.unloadCommand(cmd);
 | 
					    method: 'post',
 | 
				
			||||||
 | 
					    body: { 'signal': 'restart' },
 | 
				
			||||||
 | 
					    headers: { 'Authorization': `Bearer ${client.config.server}` }
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					 | 
				
			||||||
  process.exit();
 | 
					 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
exports.conf = {
 | 
					exports.conf = {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue