feat: new slash commands and bug fixes #23

Merged
naomi merged 5 commits from feat/commands-two into main 2026-03-12 23:47:46 -07:00
2 changed files with 11 additions and 6 deletions
Showing only changes of commit 343d712e33 - Show all commits
+4 -2
View File
@@ -29,6 +29,8 @@ export const handleMessageCreate = async(
amari.recentlyActiveChannels.add(message.channel.id);
}
await updateMentorshipThread(amari, message);
await respondToMention(amari, message);
await notifyNameMention(amari, message);
const mentionNotified = await respondToMention(amari, message);
if (!mentionNotified) {
await notifyNameMention(amari, message);
}
};
+7 -4
View File
@@ -15,21 +15,22 @@ import type { Amari } from "../interfaces/amari.js";
* If so, responds.
* @param amari -- Amari's instance.
* @param message -- The guild message payload from Discord.
* @returns Whether a DM notification was sent.
*/
// eslint-disable-next-line complexity -- Mainly those reply options...
export const respondToMention = async(
amari: Amari,
message: Message<true>,
): Promise<void> => {
): Promise<boolean> => {
try {
const naomi = amari.discord.users.cache.get(ids.users.naomi)
?? await amari.discord.users.fetch(ids.users.naomi);
const { mentions, content, author, url, channel } = message;
if (author.bot || author.id === ids.users.naomi) {
return;
return false;
}
if (amari.recentlyActiveChannels.has(channel.id)) {
return;
return false;
}
const mentionsNaomi = mentions.has(ids.users.naomi, {
ignoreEveryone: true,
@@ -45,7 +46,7 @@ export const respondToMention = async(
ignoreRoles: true,
}) || /nhcarrigan/i.test(content);
if (!mentionsNaomi && !mentionsNHCarrigan) {
return;
return false;
}
await naomi.send(
{
@@ -56,9 +57,11 @@ export const respondToMention = async(
await logger.metric("processed_mention", 1, { pingType: mentionsNaomi
? "naomi"
: "nhcarrigan", user: author.id });
return true;
} catch (error) {
if (error instanceof Error) {
await logger.error("respond to mention module", error);
}
return false;
}
};