randydev commited on
Commit
79febdc
·
verified ·
1 Parent(s): 0e415fc

Add too many

Browse files
Files changed (1) hide show
  1. chatbot/plugins/chat.py +32 -8
chatbot/plugins/chat.py CHANGED
@@ -336,7 +336,13 @@ async def geminigen_prompt(client, callback):
336
  return
337
  except Exception as e:
338
  LOGS.error(f"geminigen_prompt failed: {str(e)}")
339
- return await callback.answer("Server busy try again later", True)
 
 
 
 
 
 
340
  finally:
341
  if file_path:
342
  try:
@@ -406,7 +412,13 @@ async def flux_prompt(client, callback):
406
  return
407
  except Exception as e:
408
  LOGS.error(f"flux_prompt failed: {str(e)}")
409
- return await callback.answer("Server busy try again later", True)
 
 
 
 
 
 
410
  finally:
411
  if file_path and file_photo:
412
  try:
@@ -426,7 +438,7 @@ async def remover_bg(client, callback):
426
  if not get_response:
427
  return await callback.answer("Server busy try again later", True)
428
  media = await client.download_media(get_response)
429
- await callback.message.edit_text("Please wait Downloading Background Remover.....")
430
  output_bg = await remove_bg_myapi(media)
431
  if not output_bg:
432
  return await callback.answer("Server busy try again later", True)
@@ -439,7 +451,13 @@ async def remover_bg(client, callback):
439
  await callback.answer()
440
  except Exception as e:
441
  LOGS.error(f"remover_bg failed: {str(e)}")
442
- await callback.answer("Server busy try again later", show_alert=True)
 
 
 
 
 
 
443
 
444
  @Client.on_callback_query(filters.regex("^refreshch$"))
445
  async def reshch(client, callback):
@@ -657,8 +675,11 @@ async def chatbot_talk(client: Client, message: Message):
657
  return await message.reply_text("You been blocked blacklisted")
658
 
659
  if re.findall(r"\b(This is a picture of me)\b", caption, re.IGNORECASE):
660
- if caption == "picture":
661
- return await message.reply_text("You can't write small, it has to be long or short first")
 
 
 
662
  try:
663
  backup_chat = await db._get_chatbot_chat_from_db(message.from_user.id)
664
  backup_chat.append({"role": "user", "parts": [{"text": caption}]})
@@ -893,8 +914,11 @@ async def chatbot_talk(client: Client, message: Message):
893
  return
894
 
895
  if re.findall(r"\b(image)\b", query_base, re.IGNORECASE):
896
- if query_base == "image":
897
- return await message.reply_text("You can't write small, it has to be long or short first")
 
 
 
898
  try:
899
  buttons = [
900
  [
 
336
  return
337
  except Exception as e:
338
  LOGS.error(f"geminigen_prompt failed: {str(e)}")
339
+ return await callback.message.edit_media(
340
+ media=InputMediaPhoto(
341
+ media="error.png",
342
+ caption="Server busy try again later"
343
+ ),
344
+ reply_markup=None
345
+ )
346
  finally:
347
  if file_path:
348
  try:
 
412
  return
413
  except Exception as e:
414
  LOGS.error(f"flux_prompt failed: {str(e)}")
415
+ return await callback.message.edit_media(
416
+ media=InputMediaPhoto(
417
+ media="error.png",
418
+ caption="Server busy try again later"
419
+ ),
420
+ reply_markup=None
421
+ )
422
  finally:
423
  if file_path and file_photo:
424
  try:
 
438
  if not get_response:
439
  return await callback.answer("Server busy try again later", True)
440
  media = await client.download_media(get_response)
441
+ await callback.message.edit_text(".....")
442
  output_bg = await remove_bg_myapi(media)
443
  if not output_bg:
444
  return await callback.answer("Server busy try again later", True)
 
451
  await callback.answer()
452
  except Exception as e:
453
  LOGS.error(f"remover_bg failed: {str(e)}")
454
+ return await callback.message.edit_media(
455
+ media=InputMediaPhoto(
456
+ media="error.png",
457
+ caption="Server busy try again later"
458
+ ),
459
+ reply_markup=None
460
+ )
461
 
462
  @Client.on_callback_query(filters.regex("^refreshch$"))
463
  async def reshch(client, callback):
 
675
  return await message.reply_text("You been blocked blacklisted")
676
 
677
  if re.findall(r"\b(This is a picture of me)\b", caption, re.IGNORECASE):
678
+ if caption == "picture" or len(caption) > 300:
679
+ return await message.reply_text(
680
+ "You can't write **picture** small, it has to be long OR short first"
681
+ "OR Caption Too many `MAX_CAPTION: 300`"
682
+ )
683
  try:
684
  backup_chat = await db._get_chatbot_chat_from_db(message.from_user.id)
685
  backup_chat.append({"role": "user", "parts": [{"text": caption}]})
 
914
  return
915
 
916
  if re.findall(r"\b(image)\b", query_base, re.IGNORECASE):
917
+ if query_base == "image" or len(query_base) > 350:
918
+ return await message.reply_text(
919
+ "You can't write **image** small, it has to be long OR short first"
920
+ "OR Text Too many `MAX_TOO_MANY_TEXT: 350`"
921
+ )
922
  try:
923
  buttons = [
924
  [