randydev commited on
Commit
f1cc6aa
·
verified ·
1 Parent(s): 190e25c

Update chatbot/plugins/chat.py

Browse files
Files changed (1) hide show
  1. chatbot/plugins/chat.py +10 -2
chatbot/plugins/chat.py CHANGED
@@ -296,7 +296,11 @@ async def chatbot_talk(client: Client, message: Message):
296
  if message.reply_to_message.from_user.id != client.me.id:
297
  return
298
  if message.text:
299
- await client.send_chat_action(message.chat.id, enums.ChatAction.TYPING)
 
 
 
 
300
  await asyncio.sleep(1.5)
301
  query = message.text.strip()
302
  match = re.search(r"\b(Randy|Rendi)\b(.*)", query, flags=re.IGNORECASE)
@@ -347,7 +351,11 @@ async def chatbot_talk(client: Client, message: Message):
347
  LOGS.warning("Error response")
348
  LOGS.info(response_log)
349
  await db._update_openai_chat_in_db(message.from_user.id, backup_chat)
350
- await client.send_chat_action(message.chat.id, enums.ChatAction.CANCEL)
 
 
 
 
351
  return
352
  except Exception as e:
353
  return await message.reply_text(
 
296
  if message.reply_to_message.from_user.id != client.me.id:
297
  return
298
  if message.text:
299
+ await client.send_chat_action(
300
+ message.chat.id,
301
+ business_connection_id=message.business_connection_id if message else None,
302
+ enums.ChatAction.TYPING,
303
+ )
304
  await asyncio.sleep(1.5)
305
  query = message.text.strip()
306
  match = re.search(r"\b(Randy|Rendi)\b(.*)", query, flags=re.IGNORECASE)
 
351
  LOGS.warning("Error response")
352
  LOGS.info(response_log)
353
  await db._update_openai_chat_in_db(message.from_user.id, backup_chat)
354
+ await client.send_chat_action(
355
+ message.chat.id,
356
+ business_connection_id=message.business_connection_id if message else None,
357
+ enums.ChatAction.CANCEL
358
+ )
359
  return
360
  except Exception as e:
361
  return await message.reply_text(