Update chatbot/plugins/chat.py
Browse files- chatbot/plugins/chat.py +12 -0
chatbot/plugins/chat.py
CHANGED
@@ -91,6 +91,14 @@ blacklist_patterns = [
|
|
91 |
r"\bdeath\s*threat\b",
|
92 |
]
|
93 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
def is_blacklisted_english(text: str) -> bool:
|
95 |
for pattern in blacklist_patterns:
|
96 |
if re.search(pattern, text, re.IGNORECASE):
|
@@ -1331,6 +1339,10 @@ async def chatbot_talk(client: Client, message: Message):
|
|
1331 |
await client.send_chat_action(message.chat.id, enums.ChatAction.CANCEL)
|
1332 |
return
|
1333 |
|
|
|
|
|
|
|
|
|
1334 |
if regex_all_blacklist(query_base) or is_blacklisted_english(query_base):
|
1335 |
unfreeze_at = dt.now() + timedelta(days=30)
|
1336 |
await db.user_blacklists.update_one(
|
|
|
91 |
r"\bdeath\s*threat\b",
|
92 |
]
|
93 |
|
94 |
+
|
95 |
+
def is_command_disabled(text):
|
96 |
+
text_lower = text.lower()
|
97 |
+
if text_lower.startswith("/") and not (text_lower.startswith("/setmodel") or text_lower.startswith("/start")):
|
98 |
+
return True
|
99 |
+
else:
|
100 |
+
return False
|
101 |
+
|
102 |
def is_blacklisted_english(text: str) -> bool:
|
103 |
for pattern in blacklist_patterns:
|
104 |
if re.search(pattern, text, re.IGNORECASE):
|
|
|
1339 |
await client.send_chat_action(message.chat.id, enums.ChatAction.CANCEL)
|
1340 |
return
|
1341 |
|
1342 |
+
if is_command_disabled(query_base):
|
1343 |
+
await client.send_chat_action(message.chat.id, enums.ChatAction.CANCEL)
|
1344 |
+
return
|
1345 |
+
|
1346 |
if regex_all_blacklist(query_base) or is_blacklisted_english(query_base):
|
1347 |
unfreeze_at = dt.now() + timedelta(days=30)
|
1348 |
await db.user_blacklists.update_one(
|