added init to appdatasource in bot.js

This commit is contained in:
Aster Fialla
2026-03-01 16:24:50 -05:00
parent 0eb03a8d11
commit 2c12b1a2ff

View File

@@ -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);