Update chatbot/plugins/chat.py
Browse files- chatbot/plugins/chat.py +6 -3
chatbot/plugins/chat.py
CHANGED
@@ -92,6 +92,7 @@ blacklist_patterns = [
|
|
92 |
r"\bdeath\s*threat\b",
|
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")):
|
@@ -1153,17 +1154,19 @@ async def chatbot_talk(client: Client, message: Message):
|
|
1153 |
)
|
1154 |
backup_chat.append({"role": "model", "parts": [{"text": captions}]})
|
1155 |
await db._update_chatbot_chat_in_db(message.from_user.id, backup_chat)
|
|
|
|
|
|
|
|
|
1156 |
await db.user_premium.update_one(
|
1157 |
{"user_id": message.from_user.id},
|
1158 |
{
|
1159 |
"$inc": {"credits_used": 1},
|
1160 |
"$set": {
|
1161 |
"last_reset": user_data["last_reset"],
|
1162 |
-
"is_premium":
|
1163 |
-
and (user_data.get("premium_expiry", dt.min) > dt.now())
|
1164 |
},
|
1165 |
"$setOnInsert": {
|
1166 |
-
"is_premium": False,
|
1167 |
"credits_used": 0,
|
1168 |
"last_reset": dt.now(),
|
1169 |
"premium_expiry": None
|
|
|
92 |
r"\bdeath\s*threat\b",
|
93 |
]
|
94 |
|
95 |
+
|
96 |
def is_command_disabled(text):
|
97 |
text_lower = text.lower()
|
98 |
if text_lower.startswith("/") and not (text_lower.startswith("/setmodel") or text_lower.startswith("/start")):
|
|
|
1154 |
)
|
1155 |
backup_chat.append({"role": "model", "parts": [{"text": captions}]})
|
1156 |
await db._update_chatbot_chat_in_db(message.from_user.id, backup_chat)
|
1157 |
+
is_active_premium = (
|
1158 |
+
user_data.get("is_premium", False) and
|
1159 |
+
user_data.get("premium_expiry", dt.min) > dt.now()
|
1160 |
+
)
|
1161 |
await db.user_premium.update_one(
|
1162 |
{"user_id": message.from_user.id},
|
1163 |
{
|
1164 |
"$inc": {"credits_used": 1},
|
1165 |
"$set": {
|
1166 |
"last_reset": user_data["last_reset"],
|
1167 |
+
"is_premium": is_active_premium
|
|
|
1168 |
},
|
1169 |
"$setOnInsert": {
|
|
|
1170 |
"credits_used": 0,
|
1171 |
"last_reset": dt.now(),
|
1172 |
"premium_expiry": None
|