From 131febc63b24bf9eb5f36231607f163c21735795 Mon Sep 17 00:00:00 2001 From: AllfatherHatt Date: Sun, 23 Feb 2025 21:25:57 +0100 Subject: [PATCH] Added detection of direction invocation --- reginaldCog/reginald.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/reginaldCog/reginald.py b/reginaldCog/reginald.py index 89b08e7..28d2c6a 100644 --- a/reginaldCog/reginald.py +++ b/reginaldCog/reginald.py @@ -148,14 +148,24 @@ class ReginaldCog(commands.Cog): def should_reginald_interject(self, message_content: str) -> bool: """Determines if Reginald should respond to a message based on keywords.""" + direct_invocation = { + "reginald,", "reginald.", "reginald!", "reginald?", "reginald please", + "excuse me reginald", "I say reginald,", "reginald my good boy", "good heavens reginald" + } + + trigger_keywords = { "reginald", "butler", "jeeves", "advice", "explain", "elaborate", - "philosophy", "etiquette", "history", "wisdom" + "philosophy", "etiquette", "history", "wisdom", "what do you think", "what does it mean", "please explain" } # ✅ Only trigger if **two or more** keywords are found message_lower = message_content.lower() + + if any(message_lower.startswith(invocation) for invocation in direct_invocation): + return True + found_keywords = [word for word in trigger_keywords if word in message_lower] return len(found_keywords) >= 2