forked from embee/woomy
		
	use strict + login error handling
This commit is contained in:
		
							parent
							
								
									33821715f2
								
							
						
					
					
						commit
						019b8a03e4
					
				
					 1 changed files with 10 additions and 2 deletions
				
			
		
							
								
								
									
										12
									
								
								index.js
									
										
									
									
									
								
							
							
						
						
									
										12
									
								
								index.js
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -1,6 +1,8 @@
 | 
			
		|||
// Woomy version 2
 | 
			
		||||
// Copyright 2020 mudkipscience
 | 
			
		||||
 | 
			
		||||
'use strict'
 | 
			
		||||
 | 
			
		||||
// Check node.js version
 | 
			
		||||
if (Number(process.version.slice(1).split('.')[0]) < 12) {
 | 
			
		||||
  console.log('NodeJS 12.0.0 or higher is required. Please update NodeJS on your system.')
 | 
			
		||||
| 
						 | 
				
			
			@ -107,10 +109,16 @@ const init = async () => {
 | 
			
		|||
  await client.db.init(client)
 | 
			
		||||
 | 
			
		||||
  // Login to Discord
 | 
			
		||||
  function failedToLogin(err) {
 | 
			
		||||
    client.logger.error('Failed to login: ' + err);
 | 
			
		||||
 | 
			
		||||
    process.exit(0);
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  if (client.devmode !== true) {
 | 
			
		||||
    client.login(client.config.token)
 | 
			
		||||
    client.login(client.config.token).catch(failedToLogin)
 | 
			
		||||
  } else {
 | 
			
		||||
    client.login(client.config.token_dev)
 | 
			
		||||
    client.login(client.config.token_dev).catch(failedToLogin)
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue