Register handlers after db opened

This commit is contained in:
Tarrgon
2026-06-03 20:17:19 -04:00
parent fd3f626db4
commit 343cb3123c
3 changed files with 14 additions and 10 deletions
+1
View File
@@ -50,6 +50,7 @@ const regexTesters = [
const uniqueRegexMatches = (g, i, a) => a.findIndex(v => v[1] == g[1]) == i;
export async function handleMessageCreate(message: Message) {
console.log('message created');
if (message.author.bot) return;
if (message.inGuild()) await Database.putMessage(message);
+5 -4
View File
@@ -140,10 +140,6 @@ client.on('clientReady', async () => {
ScheduledTasks.forEach(task => scheduler.add(task));
ready = true;
console.log('Ready');
});
client.on('guildAuditLogEntryCreate', handleAuditLogCreate);
client.on('guildBanRemove', handleBanRemove);
client.on('guildCreate', handleGuildCreate);
@@ -155,6 +151,11 @@ client.on('messageUpdate', handleMessageUpdate);
client.on('threadCreate', handleThreadCreate);
client.on('voiceStateUpdate', handleVoiceStateUpdate);
ready = true;
console.log('Ready');
});
client.on('error', console.error);
process.on('uncaughtException', console.error);
+2
View File
@@ -122,6 +122,8 @@ export class Database {
static async open(file: string): Promise<void> {
if (Database.db) return;
console.log('Opening SQLite database')
Database.db = await open({
filename: file,
driver: sqlite3.Database