import { Events } from "discord.js";
import { userService } from "@shared/modules/user/user.service";
import { levelingService } from "@shared/modules/leveling/leveling.service";
import type { Event } from "@shared/lib/types";

const event: Event<Events.MessageCreate> = {
    name: Events.MessageCreate,
    execute: 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);

        // Activity Tracking for Lootdrops
        import("@shared/modules/economy/lootdrop.service").then(m => m.lootdropService.processMessage(message));
    },
};

export default event;
