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>
31 lines
760 B
TypeScript
31 lines
760 B
TypeScript
/**
|
|
* @copyright NHCarrigan
|
|
* @license Naomi's Public License
|
|
* @author Naomi Carrigan
|
|
*/
|
|
|
|
import { appendFileSync, existsSync, readFileSync } from "node:fs";
|
|
|
|
const filePath = "data/welcomed.txt";
|
|
|
|
const loadWelcomedMentees = (): Set<string> => {
|
|
if (!existsSync(filePath)) {
|
|
return new Set();
|
|
}
|
|
const contents = readFileSync(filePath, "utf-8");
|
|
return new Set(contents.split("\n").filter(Boolean));
|
|
};
|
|
|
|
const welcomedMentees = loadWelcomedMentees();
|
|
|
|
/**
|
|
* Appends a mentee's ID to the welcomed set and persists it to disk.
|
|
* @param id - The Discord user ID to record.
|
|
*/
|
|
const addWelcomedMentee = (id: string): void => {
|
|
welcomedMentees.add(id);
|
|
appendFileSync(filePath, `${id}\n`);
|
|
};
|
|
|
|
export { addWelcomedMentee, welcomedMentees };
|