8ball: add third-party branch for Jared asking about someone other than himself/Wynter
Lint / Shell (shellcheck) (push) Successful in 10s
Lint / JS (eslint) (push) Successful in 6s
Lint / Python (ruff) (push) Successful in 6s
Lint / Python deps (pip-audit) (push) Successful in 45s
Lint / Secret scan (gitleaks) (push) Successful in 5s

When Jared asks about a @mentioned third party, give a neutral honest
prediction instead of hijacking the answer to be about Jared.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-22 11:22:49 -04:00
parent 6e0a738552
commit 3405ab8b32
+22 -2
View File
@@ -310,8 +310,10 @@ async def cmd_8ball(client: AsyncClient, room_id: str, sender: str, args: str):
q_lower = question.lower() q_lower = question.lower()
about_wynter = bool(re.search(r'\b(wynter|she|her|herself)\b', q_lower)) about_wynter = bool(re.search(r'\b(wynter|she|her|herself)\b', q_lower))
about_jared = bool(re.search(r'\b(jared|he|him|himself)\b', q_lower)) about_jared = bool(re.search(r'\b(jared|he|him|himself)\b', q_lower))
# Detect third-party questions: mentions someone else via @ or a name other than jared/wynter
has_other_mention = bool(re.search(r'@\S+', q_lower)) and not about_wynter and not about_jared
is_jared_branch = (sender == JARED_ID and not about_wynter) is_jared_branch = (sender == JARED_ID and not about_wynter and not has_other_mention)
if sender == JARED_ID and about_wynter: if sender == JARED_ID and about_wynter:
# Jared asking about Wynter — mock her, side with Jared # Jared asking about Wynter — mock her, side with Jared
_answer_color = "#ef4444" _answer_color = "#ef4444"
@@ -348,8 +350,26 @@ async def cmd_8ball(client: AsyncClient, room_id: str, sender: str, args: str):
"Jared already knew the answer. Wynter didn't.", "Jared already knew the answer. Wynter didn't.",
"The signs were always pointing away from Wynter.", "The signs were always pointing away from Wynter.",
]) ])
elif sender == JARED_ID and has_other_mention:
# Jared asking about a third party — give a straight prediction
_answer_color = "#f59e0b"
q_for_prompt = question
bio_context = ""
prompt = (
"You are a magic 8-ball. Answer the question with a short, one-sentence prediction. "
"Be honest and direct — not biased toward any particular person. "
"Respond in normal sentence case. One sentence max. Give only your prediction, no questions back.\n\n"
f"Question: {q_for_prompt}"
)
fallback = random.choice([
"Signs point to yes.",
"Outlook uncertain.",
"Don't count on it.",
"Most likely.",
"Ask again later.",
])
elif sender == JARED_ID: elif sender == JARED_ID:
# Jared asking about anything else — always positive about Jared # Jared asking about himself or general — always positive about Jared
_answer_color = "#22c55e" _answer_color = "#22c55e"
q_for_prompt = _replace_first_person(question, "Jared") q_for_prompt = _replace_first_person(question, "Jared")
bio_relevant = any(kw in q_lower for kw in { bio_relevant = any(kw in q_lower for kw in {