feat: mentorship improvements and name mention notifications (#14)
Node.js CI / CI (push) Successful in 36s
Security Scan and Upload / Security & DefectDojo Upload (push) Successful in 1m27s

## Summary

- **Name/title mention notifications**: Amari now notifies Naomi when a message contains her name, common nicknames (`nomi`, `nao`, `nae`, `naonao`), or honorifics (`goddess`, `queen`, `mistress`, `your/her majesty`, `your/her highness`). Uses the same cooldown logic as mention forwarding.
- **Simplified mentee onboarding**: Replaced the lengthy welcome message with a concise prompt asking the new mentee to ping Naomi with their GitHub username and name.
- **Removed offboard notification**: `logMenteeLeave` now only logs a metric silently — no more "user must be offboarded" messages in the channel.
- **Deduplicated welcome messages**: Welcomed mentee IDs are persisted to `data/welcomed.txt` so the onboarding message is only ever sent once, even if the role is re-assigned.

## Test plan

- [ ] Assign mentorship role to a user and confirm the new onboarding message appears
- [ ] Re-assign the role to the same user and confirm no duplicate message is sent
- [ ] Remove a mentee from the server and confirm no offboard message is posted
- [ ] Send a message containing a matched name/honorific and confirm Naomi receives a DM forwarding it

 This PR was created with help from Hikari~ 🌸

Co-authored-by: Naomi Carrigan <commits@nhcarrigan.com>
Reviewed-on: #14
Co-authored-by: Hikari <hikari@nhcarrigan.com>
Co-committed-by: Hikari <hikari@nhcarrigan.com>
This commit was merged in pull request #14.
This commit is contained in:
2026-03-02 16:03:14 -08:00
committed by Naomi Carrigan
parent 5c39d3d9ce
commit 5e149a29e4
9 changed files with 265 additions and 33 deletions
+1 -23
View File
@@ -6,40 +6,18 @@
import { ids } from "../config/ids.js";
import { logger } from "../utils/logger.js";
import type { Amari } from "../interfaces/amari.js";
import type { GuildMember, PartialGuildMember } from "discord.js";
/**
* Run when a guild member leaves. If the member had the mentorship role,
* notify Naomi.
* @param amari - Amari's instance.
* log the metric.
* @param member - The member payload from Discord.
*/
export const logMenteeLeave = async(
amari: Amari,
member: GuildMember | PartialGuildMember,
): Promise<void> => {
if (!member.roles.cache.has(ids.roles.mentorship)) {
return;
}
const channel = amari.discord.channels.cache.get(ids.channels.menteeChat)
?? await amari.discord.channels.fetch(ids.channels.menteeChat);
if (channel?.isSendable() !== true) {
await logger.log(
"warn",
"Mentee Chat channel does not exist or is not sendable.",
);
return;
}
await channel.send({
content: `Hey <@${ids.users.naomi}>~!
<@${member.id}> (${member.user.displayName} - ${member.id}) has left the server.
It seems they were part of the mentorship programme, so you may need to offboard them.`,
});
await logger.metric("processed_mentee_leave", 1, { user: member.id });
};