Files
amari/src/events/handleMessageCreate.ts
T
hikari a36d706eed
Node.js CI / CI (push) Successful in 29s
Security Scan and Upload / Security & DefectDojo Upload (push) Failing after 11m44s
feat: new slash commands and bug fixes (#23)
## Summary

- **feat**: Add `/remind` owner-only command — sends a meeting waiting room notification to a specified user in `#general`
- **fix**: Prevent duplicate DM notifications when a message matches both `respondToMention` and `notifyNameMention` patterns
- **feat**: Port `/alt-text` and `/query` commands from Cordelia — owner-only, AI-powered, using Amari's personality
- **feat**: Add `/research` command — owner-only, web-search-backed query returning results as a markdown file attachment
- **fix**: Suppress non-critical RetroAchievements fetch errors (job retries every 10 minutes)

Closes #19, #20, #21, #22
Also resolves #2 (unhandled HTTP rejections from RA API)

Reviewed-on: #23
Co-authored-by: Hikari <hikari@nhcarrigan.com>
Co-committed-by: Hikari <hikari@nhcarrigan.com>
2026-03-12 23:47:46 -07:00

37 lines
1.2 KiB
TypeScript

/**
* @copyright NHCarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import { ids } from "../config/ids.js";
import { notifyNameMention } from "../modules/notifyNameMention.js";
import { respondToMention } from "../modules/respondToMention.js";
import { updateMentorshipThread } from "../modules/updateMentorshipThread.js";
import type { Amari } from "../interfaces/amari.js";
import type { Message } from "discord.js";
/**
* Handles the message create event from Discord.
* Bootstraps all of our custom logic modules.
* @param amari -- Amari's instance.
* @param message -- The guild message payload from Discord.
*/
export const handleMessageCreate = async(
amari: Amari,
message: Message<true>,
): Promise<void> => {
if (message.author.bot || message.system) {
return;
}
if (message.author.id === ids.users.naomi
&& !amari.recentlyActiveChannels.has(message.channel.id)) {
amari.recentlyActiveChannels.add(message.channel.id);
}
await updateMentorshipThread(amari, message);
const mentionNotified = await respondToMention(amari, message);
if (!mentionNotified) {
await notifyNameMention(amari, message);
}
};