- Fixed a bug where the bot would crash if the db connection took too long - Updated packages to latest version - Bumped version to 1.1.1
		
			
				
	
	
		
			21 lines
		
	
	
		
			606 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			21 lines
		
	
	
		
			606 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| import { runCleanup } from "../service";
 | |
| import client from "./index";
 | |
| import { initPromise } from "../data/dataSource";
 | |
| 
 | |
| const token = process.env["TOKEN"];
 | |
| if (!token) throw new ReferenceError("TOKEN environment variable is missing");
 | |
| 
 | |
| async function run() {
 | |
|     console.log("Establishing database connection");
 | |
|     await initPromise;
 | |
|     console.log("Connection established\nAuthenticating with Discord API");
 | |
|     client.login(token);
 | |
| }
 | |
| 
 | |
| client.on("ready", async () => {
 | |
|     console.log(`Connected to Discord API. Bot account is ${client.user?.tag} (${client.user?.id})`);
 | |
| 
 | |
|     runCleanup();
 | |
| });
 | |
| 
 | |
| run(); |