feat: build out discord support agent
All checks were successful
Node.js CI / Lint and Test (pull_request) Successful in 1m17s

This commit is contained in:
2025-07-05 23:06:45 -07:00
parent af33e704a4
commit cd5c3761f4
33 changed files with 1300 additions and 0 deletions

36
bot/prod/index.js Normal file
View File

@ -0,0 +1,36 @@
/**
* @copyright nhcarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import { Client, Events, GatewayIntentBits, Partials } from "discord.js";
import { chatInputInteractionCreate } from "./events/interactionCreate.js";
import { guildMessageCreate, directMessageCreate, } from "./events/messageCreate.js";
import { logger } from "./utils/logger.js";
const hikari = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
GatewayIntentBits.DirectMessages,
],
partials: [
Partials.Channel,
],
});
hikari.once(Events.ClientReady, () => {
void logger.log("debug", `Logged in as ${hikari.user?.username ?? "unknown"}`);
});
hikari.on(Events.MessageCreate, (message) => {
if (!message.inGuild()) {
void directMessageCreate(hikari, message);
return;
}
void guildMessageCreate(hikari, message);
});
hikari.on(Events.InteractionCreate, (interaction) => {
if (interaction.isChatInputCommand()) {
void chatInputInteractionCreate(hikari, interaction);
}
});
await hikari.login(process.env.DISCORD_TOKEN);