feat: manage tags in resume channel
Node.js CI / Lint and Test (push) Successful in 38s

This commit is contained in:
2025-08-20 12:51:44 -07:00
parent b5c19abb52
commit 19ae5eded8
2 changed files with 32 additions and 8 deletions
+5
View File
@@ -9,6 +9,7 @@ export const ids = {
mentorshipGoalForum: "1400629118110011526", mentorshipGoalForum: "1400629118110011526",
mentorshipProjectForum: "1400616702265266186", mentorshipProjectForum: "1400616702265266186",
news: "1407804798677418198", news: "1407804798677418198",
resumeReviewForum: "1407807555266154496",
}, },
roles: { roles: {
nhcarrigan: "1355033209037127771", nhcarrigan: "1355033209037127771",
@@ -22,6 +23,10 @@ export const ids = {
member: "1406355801983025183", member: "1406355801983025183",
naomi: "1406355770336870420", naomi: "1406355770336870420",
}, },
resume: {
member: "1407807699718111292",
naomi: "1407807752549699727",
},
}, },
users: { users: {
amari: "1406431359345496255", amari: "1406431359345496255",
+27 -8
View File
@@ -9,6 +9,25 @@ import { logger } from "../utils/logger.js";
import type { Amari } from "../interfaces/amari.js"; import type { Amari } from "../interfaces/amari.js";
import type { Message } from "discord.js"; import type { Message } from "discord.js";
const getTag = (id: string, type: "naomi" | "member"): string => {
if (id === ids.channels.mentorshipGoalForum) {
return type === "naomi"
? ids.tags.goal.naomi
: ids.tags.goal.member;
}
if (id === ids.channels.mentorshipProjectForum) {
return type === "naomi"
? ids.tags.project.naomi
: ids.tags.project.member;
}
if (id === ids.channels.resumeReviewForum) {
return type === "naomi"
? ids.tags.resume.naomi
: ids.tags.resume.member;
}
return "";
};
/** /**
* Processes a message in a mentorship thread. Applies either * Processes a message in a mentorship thread. Applies either
* the `waiting on member` tag or the `waiting on naomi` tag, * the `waiting on member` tag or the `waiting on naomi` tag,
@@ -16,7 +35,6 @@ import type { Message } from "discord.js";
* @param _amari -- Amari's instance. * @param _amari -- Amari's instance.
* @param message -- The guild message payload from Discord. * @param message -- The guild message payload from Discord.
*/ */
// eslint-disable-next-line complexity -- Fuck off.
export const updateMentorshipThread = async( export const updateMentorshipThread = async(
_amari: Amari, _amari: Amari,
message: Message<true>, message: Message<true>,
@@ -26,19 +44,20 @@ export const updateMentorshipThread = async(
if (!channel.isThread() || channel.parent?.isThreadOnly() !== true) { if (!channel.isThread() || channel.parent?.isThreadOnly() !== true) {
return; return;
} }
const { mentorshipGoalForum, mentorshipProjectForum } = ids.channels; const {
mentorshipGoalForum,
mentorshipProjectForum,
resumeReviewForum,
} = ids.channels;
if (![ if (![
mentorshipGoalForum, mentorshipGoalForum,
mentorshipProjectForum, mentorshipProjectForum,
resumeReviewForum,
].includes(channel.parent.id)) { ].includes(channel.parent.id)) {
return; return;
} }
const memberTag = channel.parentId === mentorshipGoalForum const memberTag = getTag(channel.parent.id, "member");
? ids.tags.goal.member const naomiTag = getTag(channel.parent.id, "naomi");
: ids.tags.project.member;
const naomiTag = channel.parentId === mentorshipGoalForum
? ids.tags.goal.naomi
: ids.tags.project.naomi;
if (author.id === ids.users.naomi) { if (author.id === ids.users.naomi) {
if (channel.appliedTags.includes(memberTag)) { if (channel.appliedTags.includes(memberTag)) {
return; return;