From 209340c06e464317200917757339cfbad720aeac Mon Sep 17 00:00:00 2001 From: syntaxbullet Date: Tue, 9 Dec 2025 12:10:58 +0100 Subject: [PATCH] feat: implement chat XP processing on message create --- src/index.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/index.ts b/src/index.ts index cf78edb..7909df1 100644 --- a/src/index.ts +++ b/src/index.ts @@ -2,6 +2,7 @@ import { Events } from "discord.js"; import { KyokoClient } from "@lib/KyokoClient"; import { env } from "@lib/env"; import { userService } from "@/modules/user/user.service"; +import { levelingService } from "@/modules/leveling/leveling.service"; // Load commands await KyokoClient.loadCommands(); @@ -11,6 +12,18 @@ KyokoClient.once(Events.ClientReady, async c => { console.log(`Ready! Logged in as ${c.user.tag}`); }); +// process xp on message +KyokoClient.on(Events.MessageCreate, async message => { + if (message.author.bot) return; + if (!message.guild) return; + + const user = await userService.getUserById(message.author.id); + if (!user) return; + + levelingService.processChatXp(message.author.id); +}); + +// handle commands KyokoClient.on(Events.InteractionCreate, async interaction => { if (!interaction.isChatInputCommand()) return;