From 2c12b1a2ff9a66493922067cb747ab864df46728 Mon Sep 17 00:00:00 2001 From: Aster Fialla Date: Sun, 1 Mar 2026 16:24:50 -0500 Subject: [PATCH] added init to appdatasource in bot.js --- src/bot.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/bot.js b/src/bot.js index 69d3a7a..5a3bec1 100644 --- a/src/bot.js +++ b/src/bot.js @@ -5,6 +5,7 @@ const {commands} = require("./commands.js"); const {webhookHelper} = require("./helpers/webhookHelper.js"); const env = require('dotenv'); const {utils} = require("./helpers/utils.js"); +const {AppDataSource} = require("../database/data-source"); env.config(); @@ -20,7 +21,7 @@ client = new Client({ intents: 0 }); module.exports.client = client; client.on(Events.MessageCreate, async (message) => { - await handleMessageCreate(message); + await module.exports.handleMessageCreate(message); }); /** @@ -85,8 +86,10 @@ const debouncePrintGuilds = utils.debounce(printGuilds, 2000); module.exports.login = async function() { try { + if (!AppDataSource.isInitialized) { + await AppDataSource.initialize(); + } await client.login(token); - // await db.check_connection(); } catch (err) { console.error('Login failed:', err); process.exit(1);