File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -106,9 +106,14 @@ def is_bot_mentioned(message_text: str) -> bool:
106106 bool: True if the bot is mentioned, False otherwise.
107107 """
108108 bot_trigger_words = ["ботяра" , "bot_health" ]
109- # Remove all non-letter characters
110- cleaned_text = '' .join (char for char in message_text .lower () if char .isalpha () or char .isspace ())
111- return any (word in cleaned_text for word in bot_trigger_words )
109+ # Remove leading/trailing whitespace and convert to lowercase
110+ cleaned_text = message_text .strip ().lower ()
111+ for word in bot_trigger_words :
112+ if cleaned_text .startswith (word ):
113+ # Check if it's followed by space, punctuation, or is the whole message
114+ if len (cleaned_text ) == len (word ) or not cleaned_text [len (word )].isalpha ():
115+ return True
116+ return False
112117
113118
114119def clean_url (message_text : str ) -> str :
You can’t perform that action at this time.
0 commit comments