2022-11-25 18:28:42 +01:00
|
|
|
import { runCleanup } from "../service";
|
2022-11-24 12:12:50 +01:00
|
|
|
import client from "./index";
|
2023-09-16 11:12:43 +02:00
|
|
|
import { initPromise } from "../data/dataSource";
|
2022-11-24 12:12:50 +01:00
|
|
|
|
|
|
|
const token = process.env["TOKEN"];
|
|
|
|
if (!token) throw new ReferenceError("TOKEN environment variable is missing");
|
|
|
|
|
2023-09-16 11:12:43 +02:00
|
|
|
async function run() {
|
|
|
|
console.log("Establishing database connection");
|
|
|
|
await initPromise;
|
|
|
|
console.log("Connection established\nAuthenticating with Discord API");
|
|
|
|
client.login(token);
|
|
|
|
}
|
2022-11-24 12:12:50 +01:00
|
|
|
|
2023-09-16 11:12:43 +02:00
|
|
|
client.on("ready", async () => {
|
2022-11-24 12:12:50 +01:00
|
|
|
console.log(`Connected to Discord API. Bot account is ${client.user?.tag} (${client.user?.id})`);
|
2022-11-25 18:28:42 +01:00
|
|
|
|
|
|
|
runCleanup();
|
2023-09-16 11:12:43 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
run();
|