Update chatbot/plugins/chat.py
Browse files- chatbot/plugins/chat.py +1 -6
chatbot/plugins/chat.py
CHANGED
@@ -251,7 +251,7 @@ async def handle_photo(client, message):
|
|
251 |
await ai_reply.edit_text("⚠️ Photo processing was canceled.")
|
252 |
finally:
|
253 |
spam_chats.remove(chat_id)
|
254 |
-
task_manager.cancel_task(chat_id)
|
255 |
|
256 |
await task_manager.add_task(chat_id, process_photo())
|
257 |
|
@@ -504,11 +504,9 @@ async def chatbot_talk(client: Client, message: Message):
|
|
504 |
if message.video:
|
505 |
await handle_video(client, message, model_)
|
506 |
if message.text:
|
507 |
-
think_typing = "Think...."
|
508 |
await client.send_chat_action(message.chat.id, enums.ChatAction.TYPING)
|
509 |
await asyncio.sleep(1.5)
|
510 |
query = message.text.strip()
|
511 |
-
close_typ = await message.reply_text(think_typing)
|
512 |
match = re.search(r"\b(Randy|Rendi)\b(.*)", query, flags=re.IGNORECASE)
|
513 |
if match:
|
514 |
rest_of_sentence = match.group(2).strip()
|
@@ -534,15 +532,12 @@ async def chatbot_talk(client: Client, message: Message):
|
|
534 |
document="chat.txt",
|
535 |
disable_notification=True
|
536 |
)
|
537 |
-
await close_typ.delete()
|
538 |
os.remove("chat.txt")
|
539 |
else:
|
540 |
-
await close_typ.delete()
|
541 |
await message.reply_text(output, disable_web_page_preview=True)
|
542 |
backup_chat.append({"role": "model", "parts": [{"text": output}]})
|
543 |
await db._update_chatbot_chat_in_db(message.from_user.id, backup_chat)
|
544 |
await client.send_chat_action(message.chat.id, enums.ChatAction.CANCEL)
|
545 |
return
|
546 |
except Exception as e:
|
547 |
-
await close_typ.delete()
|
548 |
return await message.reply_text(f"Error: {e}")
|
|
|
251 |
await ai_reply.edit_text("⚠️ Photo processing was canceled.")
|
252 |
finally:
|
253 |
spam_chats.remove(chat_id)
|
254 |
+
await task_manager.cancel_task(chat_id)
|
255 |
|
256 |
await task_manager.add_task(chat_id, process_photo())
|
257 |
|
|
|
504 |
if message.video:
|
505 |
await handle_video(client, message, model_)
|
506 |
if message.text:
|
|
|
507 |
await client.send_chat_action(message.chat.id, enums.ChatAction.TYPING)
|
508 |
await asyncio.sleep(1.5)
|
509 |
query = message.text.strip()
|
|
|
510 |
match = re.search(r"\b(Randy|Rendi)\b(.*)", query, flags=re.IGNORECASE)
|
511 |
if match:
|
512 |
rest_of_sentence = match.group(2).strip()
|
|
|
532 |
document="chat.txt",
|
533 |
disable_notification=True
|
534 |
)
|
|
|
535 |
os.remove("chat.txt")
|
536 |
else:
|
|
|
537 |
await message.reply_text(output, disable_web_page_preview=True)
|
538 |
backup_chat.append({"role": "model", "parts": [{"text": output}]})
|
539 |
await db._update_chatbot_chat_in_db(message.from_user.id, backup_chat)
|
540 |
await client.send_chat_action(message.chat.id, enums.ChatAction.CANCEL)
|
541 |
return
|
542 |
except Exception as e:
|
|
|
543 |
return await message.reply_text(f"Error: {e}")
|