mirror of
https://github.com/pieartsy/PluralFlux.git
synced 2026-04-17 01:55:27 +10:00
added init to appdatasource in bot.js
This commit is contained in:
@@ -5,6 +5,7 @@ const {commands} = require("./commands.js");
|
|||||||
const {webhookHelper} = require("./helpers/webhookHelper.js");
|
const {webhookHelper} = require("./helpers/webhookHelper.js");
|
||||||
const env = require('dotenv');
|
const env = require('dotenv');
|
||||||
const {utils} = require("./helpers/utils.js");
|
const {utils} = require("./helpers/utils.js");
|
||||||
|
const {AppDataSource} = require("../database/data-source");
|
||||||
|
|
||||||
env.config();
|
env.config();
|
||||||
|
|
||||||
@@ -20,7 +21,7 @@ client = new Client({ intents: 0 });
|
|||||||
module.exports.client = client;
|
module.exports.client = client;
|
||||||
|
|
||||||
client.on(Events.MessageCreate, async (message) => {
|
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() {
|
module.exports.login = async function() {
|
||||||
try {
|
try {
|
||||||
|
if (!AppDataSource.isInitialized) {
|
||||||
|
await AppDataSource.initialize();
|
||||||
|
}
|
||||||
await client.login(token);
|
await client.login(token);
|
||||||
// await db.check_connection();
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Login failed:', err);
|
console.error('Login failed:', err);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
|
|||||||
Reference in New Issue
Block a user