···11+import type { ChatInputCommandInteraction } from "discord.js";
12import { Handler } from "../core/Handler";
23import type { Command } from "../loaders/CommandLoader";
44+import type { VoidyClient } from "../core/VoidyClient";
3546export class CommandHandler extends Handler<Command> {
55- public invoke(data: Command): void {
77+ public constructor(
88+ client: VoidyClient
99+ ) {
1010+ super(client);
1111+ }
1212+1313+ public invoke(data: ChatInputCommandInteraction): void {
614 console.log(data);
1515+ // @Todo: implement invoke method, which fetches command information from registries, based on the command name
1616+ //
1717+ // @Todo: consider whether we actually need handlers as separate classes, or if we can just give the client a handle method.
718 }
819}
-4
src/index.ts
···11import { GatewayIntentBits } from "discord.js"
22import { VoidyClient } from "./core/VoidyClient"
33-// import { EventLoader } from "./loaders/EventLoader";
44-// import { join } from "node:path";
5364// Client initialization with intents and stuff...
75const client = new VoidyClient({
86 intents: [GatewayIntentBits.Guilds],
97})
1010-1111-128139// Token validation and client start
1410if (!Bun.env.BOT_TOKEN) throw new Error("[Voidy] Missing bot token");
+3
src/modules/core/events/interactionCreate.ts
···11import { Events, type Interaction } from "discord.js";
22import type { Event } from "../../../loaders/EventLoader";
33import type { VoidyClient } from "../../../core/VoidyClient";
44+import { CommandHandler } from "../../../handlers/CommandHandler";
4556export default {
67 name: Events.InteractionCreate,
···89 if (!interaction.isChatInputCommand() || !interaction.isCommand()) return null;
9101011 console.log(interaction.commandName);
1212+1313+1114 }
1215} as Event