some abstraction and I'm gonna kill myself

This commit is contained in:
2025-08-03 19:43:05 +00:00
parent 2111a47411
commit a04cb9a6ad
2 changed files with 33 additions and 20 deletions

View File

@ -34,6 +34,34 @@ const recordPendingResponse = async (notification: Notification) => {
}
};
const shouldContinue = (notification: Notification) => {
// wow this is bad
try {
const { botAccountId } = envConfig;
const statusContent = trimInputData(notification.status.content);
if (
notification.status.visibility !== "private" &&
!notification.account.bot &&
notification.type === "mention"
) {
if (notification.status.in_reply_to_account_id === botAccountId) {
return true;
} else if (
notification.status.in_reply_to_account_id !== botAccountId &&
statusContent.includes("Lexi")
) {
return true;
} else {
return false;
}
}
} catch (error: unknown) {
if (error instanceof Error) {
throw new Error(error.message);
}
}
};
const isFromWhitelistedDomain = (notification: Notification): boolean => {
try {
const domain = notification.status.account.fqn.split("@")[1];
@ -76,4 +104,5 @@ export {
trimInputData,
recordPendingResponse,
isFromWhitelistedDomain,
shouldContinue,
};