generated from nhcarrigan/template
5e149a29e4
## 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>
24 lines
651 B
TypeScript
24 lines
651 B
TypeScript
/**
|
|
* @copyright NHCarrigan
|
|
* @license Naomi's Public License
|
|
* @author Naomi Carrigan
|
|
*/
|
|
|
|
import { ids } from "../config/ids.js";
|
|
import { logger } from "../utils/logger.js";
|
|
import type { GuildMember, PartialGuildMember } from "discord.js";
|
|
|
|
/**
|
|
* Run when a guild member leaves. If the member had the mentorship role,
|
|
* log the metric.
|
|
* @param member - The member payload from Discord.
|
|
*/
|
|
export const logMenteeLeave = async(
|
|
member: GuildMember | PartialGuildMember,
|
|
): Promise<void> => {
|
|
if (!member.roles.cache.has(ids.roles.mentorship)) {
|
|
return;
|
|
}
|
|
await logger.metric("processed_mentee_leave", 1, { user: member.id });
|
|
};
|