From 7d0b5dc459534dcd79edcadc9c5e38009def701e Mon Sep 17 00:00:00 2001 From: neru Date: Tue, 13 Jan 2026 18:36:54 -0300 Subject: [PATCH] feat: implement db --- src/bot.ts | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/src/bot.ts b/src/bot.ts index bead886..4540f6b 100644 --- a/src/bot.ts +++ b/src/bot.ts @@ -11,6 +11,7 @@ import { import { Logger } from './utils/log'; import { config } from './utils/config'; import { CommandManager } from './commands'; +import { DatabaseManager } from './modules/db'; type BotEventListeners = { messageCreate: (message: Message) => void; @@ -30,8 +31,8 @@ export class Bot { } = {}; /* - class methods - */ + class methods + */ private constructor() { this.log = new Logger('Bot'); this.cmdMgr = new CommandManager('./commands'); @@ -46,6 +47,12 @@ export class Bot { this.log.info('Loading commands'); await this.cmdMgr.init(); + this.log.info('Configuring database'); + DatabaseManager.get.init( + this.cmdMgr.getUserKeys(), + this.cmdMgr.getGuildKeys() + ); + this.log.info('Instantiating client'); this.client = new Client({ intents: [ @@ -77,8 +84,8 @@ export class Bot { } /* - event listeners - */ + event listeners + */ private onReady(): void { this.log.info('Logged in'); @@ -120,8 +127,8 @@ export class Bot { } /* - public event listeners - */ + public event listeners + */ private async onInteraction(interaction: Interaction): Promise { this.emit('interactionCreate', interaction); } @@ -138,8 +145,8 @@ export class Bot { } /* - registerable event system - */ + registerable event system + */ public on( event: K, listener: BotEventListener @@ -197,8 +204,8 @@ export class Bot { } /* - singleton logic - */ + singleton logic + */ static #instance: Bot | null = null; public static get get(): Bot {