/** * @copyright nhcarrigan * @license Naomi's Public License * @author Naomi Carrigan */ import { Client, Events, type ChatInputCommandInteraction } from "discord.js"; import { about } from "./modules/about.js"; import { alt } from "./modules/alt.js"; import { evaluate } from "./modules/evaluate.js"; import { mood } from "./modules/mood.js"; import { proofread } from "./modules/proofread.js"; import { query } from "./modules/query.js"; import { summarise } from "./modules/summarise.js"; import { instantiateServer } from "./server/serve.js"; import { logger } from "./utils/logger.js"; const commands: Record< string, (interaction: ChatInputCommandInteraction)=> Promise > = { "about": about, // eslint-disable-next-line @typescript-eslint/naming-convention -- Command names cannot use camelCase. "alt-text": alt, "eval": evaluate, "mood": mood, "proofread": proofread, "query": query, "summarise": summarise, }; const client = new Client({ intents: [], }); client.on(Events.InteractionCreate, (interaction) => { if (interaction.isChatInputCommand()) { const handler = commands[interaction.commandName]; if (handler) { void handler(interaction); } } }); client.on(Events.ClientReady, () => { void logger.log("debug", "Bot is ready."); }); instantiateServer(); await client.login(process.env.DISCORD_TOKEN);