feat: new slash commands and bug fixes (#23)
Node.js CI / CI (push) Successful in 29s
Security Scan and Upload / Security & DefectDojo Upload (push) Failing after 11m44s

## 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>
This commit was merged in pull request #23.
This commit is contained in:
2026-03-12 23:47:46 -07:00
committed by Naomi Carrigan
parent 8f2cd94c82
commit a36d706eed
9 changed files with 502 additions and 11 deletions
+57
View File
@@ -0,0 +1,57 @@
/**
* @copyright NHCarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import { MessageFlags, type ChatInputCommandInteraction } from "discord.js";
import { ids } from "../config/ids.js";
import { logger } from "../utils/logger.js";
import { makeAiRequest } from "../utils/makeAiRequest.js";
import type { Amari } from "../interfaces/amari.js";
const fallbackResponse = "I'm sorry, I don't have an answer for that."
+ " Please try again later.";
/**
* Accepts an arbitrary question and sends it to Claude to be answered.
* @param _amari - The Amari instance (unused but kept for handler consistency).
* @param interaction - The Discord slash command interaction.
*/
export const query = async(
_amari: Amari,
interaction: ChatInputCommandInteraction,
): Promise<void> => {
if (interaction.user.id !== ids.users.naomi) {
await interaction.reply({
content: "This command is restricted to Naomi.",
flags: [ MessageFlags.Ephemeral ],
});
return;
}
const prompt = interaction.options.getString("prompt", true);
await interaction.deferReply({ flags: [ MessageFlags.Ephemeral ] });
try {
const response = await makeAiRequest({
maxTokens: 2000,
systemPrompt: "Your role in this conversation is to answer the user's"
+ " question to the best of your abilities. When possible, include"
+ " links to relevant sources.",
userMessage: prompt,
});
await interaction.editReply({
content: response ?? fallbackResponse,
});
} catch (error) {
await logger.error("query command", error instanceof Error
? error
: new Error(String(error)));
await interaction.editReply({
content: "Something went wrong whilst processing your question.",
});
}
};