import { Events } from "discord.js";
import { ComponentInteractionHandler, AutocompleteHandler, CommandHandler } from "@/lib/handlers";
import type { Event } from "@shared/lib/types";

const event: Event<Events.InteractionCreate> = {
    name: Events.InteractionCreate,
    execute: async (interaction) => {
        if (interaction.isButton() || interaction.isStringSelectMenu() || interaction.isModalSubmit()) {
            return ComponentInteractionHandler.handle(interaction);
        }

        if (interaction.isAutocomplete()) {
            return AutocompleteHandler.handle(interaction);
        }

        if (interaction.isChatInputCommand()) {
            return CommandHandler.handle(interaction);
        }
    },
};

export default event;
