21 lines
606 B
TypeScript
Raw Normal View History

2022-11-25 18:28:42 +01:00
import { runCleanup } from "../service";
2022-11-24 12:12:50 +01:00
import client from "./index";
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");
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
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();
});
run();