Added detection of direction invocation
This commit is contained in:
parent
a2646eac14
commit
131febc63b
@ -148,14 +148,24 @@ class ReginaldCog(commands.Cog):
|
|||||||
def should_reginald_interject(self, message_content: str) -> bool:
|
def should_reginald_interject(self, message_content: str) -> bool:
|
||||||
"""Determines if Reginald should respond to a message based on keywords."""
|
"""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 = {
|
trigger_keywords = {
|
||||||
"reginald", "butler", "jeeves",
|
"reginald", "butler", "jeeves",
|
||||||
"advice", "explain", "elaborate",
|
"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
|
# ✅ Only trigger if **two or more** keywords are found
|
||||||
message_lower = message_content.lower()
|
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]
|
found_keywords = [word for word in trigger_keywords if word in message_lower]
|
||||||
|
|
||||||
return len(found_keywords) >= 2
|
return len(found_keywords) >= 2
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user