Fixed
Browse files- chatbot/plugins/chat.py +19 -17
chatbot/plugins/chat.py
CHANGED
@@ -298,8 +298,7 @@ async def geminigen_prompt(client, callback):
|
|
298 |
if regex_all_blacklist(get_response):
|
299 |
return await callback.answer("You been blocked blacklisted", True)
|
300 |
|
301 |
-
await callback.
|
302 |
-
await callback.message.delete()
|
303 |
await client.send_chat_action(callback.message.chat.id, enums.ChatAction.UPLOAD_PHOTO)
|
304 |
await asyncio.sleep(2.0)
|
305 |
backup_chat.append({"role": "user", "parts": [{"text": get_response}]})
|
@@ -318,11 +317,13 @@ async def geminigen_prompt(client, callback):
|
|
318 |
image = Image.open(BytesIO((part.inline_data.data)))
|
319 |
image.save(file_path)
|
320 |
|
321 |
-
|
322 |
-
await callback.message.
|
323 |
-
|
324 |
-
|
325 |
-
|
|
|
|
|
326 |
)
|
327 |
await db.backup_chatbot.update_one(
|
328 |
{"user_id": user_id},
|
@@ -335,7 +336,7 @@ async def geminigen_prompt(client, callback):
|
|
335 |
return
|
336 |
except Exception as e:
|
337 |
LOGS.error(f"geminigen_prompt failed: {str(e)}")
|
338 |
-
await callback.
|
339 |
finally:
|
340 |
if file_path:
|
341 |
try:
|
@@ -359,8 +360,7 @@ async def flux_prompt(client, callback):
|
|
359 |
if regex_all_blacklist(get_response):
|
360 |
return await callback.answer("You been blocked blacklisted", True)
|
361 |
|
362 |
-
await callback.
|
363 |
-
await callback.message.delete()
|
364 |
await client.send_chat_action(callback.message.chat.id, enums.ChatAction.UPLOAD_PHOTO)
|
365 |
await asyncio.sleep(2.0)
|
366 |
backup_chat.append({"role": "user", "parts": [{"text": get_response}]})
|
@@ -388,9 +388,11 @@ async def flux_prompt(client, callback):
|
|
388 |
]
|
389 |
)
|
390 |
keyboard = create_keyboard(user_id=user_id)
|
391 |
-
await callback.message.
|
392 |
-
|
393 |
-
|
|
|
|
|
394 |
reply_markup=keyboard
|
395 |
)
|
396 |
await db.backup_chatbot.update_one(
|
@@ -404,7 +406,7 @@ async def flux_prompt(client, callback):
|
|
404 |
return
|
405 |
except Exception as e:
|
406 |
LOGS.error(f"flux_prompt failed: {str(e)}")
|
407 |
-
await callback.
|
408 |
finally:
|
409 |
if file_path and file_photo:
|
410 |
try:
|
@@ -919,9 +921,9 @@ async def chatbot_talk(client: Client, message: Message):
|
|
919 |
{"$set": {"prompt_image": query_base}},
|
920 |
upsert=True
|
921 |
)
|
922 |
-
await message.
|
923 |
-
"
|
924 |
-
|
925 |
reply_markup=InlineKeyboardMarkup(buttons)
|
926 |
)
|
927 |
return
|
|
|
298 |
if regex_all_blacklist(get_response):
|
299 |
return await callback.answer("You been blocked blacklisted", True)
|
300 |
|
301 |
+
await callback.message.edit_text("....")
|
|
|
302 |
await client.send_chat_action(callback.message.chat.id, enums.ChatAction.UPLOAD_PHOTO)
|
303 |
await asyncio.sleep(2.0)
|
304 |
backup_chat.append({"role": "user", "parts": [{"text": get_response}]})
|
|
|
317 |
image = Image.open(BytesIO((part.inline_data.data)))
|
318 |
image.save(file_path)
|
319 |
|
320 |
+
keyboard = create_keyboard(user_id=user_id)
|
321 |
+
await callback.message.edit_media(
|
322 |
+
media=InputMediaPhoto(
|
323 |
+
media=file_path,
|
324 |
+
caption=captions
|
325 |
+
),
|
326 |
+
reply_markup=keyboard
|
327 |
)
|
328 |
await db.backup_chatbot.update_one(
|
329 |
{"user_id": user_id},
|
|
|
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:
|
|
|
360 |
if regex_all_blacklist(get_response):
|
361 |
return await callback.answer("You been blocked blacklisted", True)
|
362 |
|
363 |
+
await callback.message.edit_text("....")
|
|
|
364 |
await client.send_chat_action(callback.message.chat.id, enums.ChatAction.UPLOAD_PHOTO)
|
365 |
await asyncio.sleep(2.0)
|
366 |
backup_chat.append({"role": "user", "parts": [{"text": get_response}]})
|
|
|
388 |
]
|
389 |
)
|
390 |
keyboard = create_keyboard(user_id=user_id)
|
391 |
+
await callback.message.edit_media(
|
392 |
+
media=InputMediaPhoto(
|
393 |
+
media=file_path,
|
394 |
+
caption=response.text
|
395 |
+
),
|
396 |
reply_markup=keyboard
|
397 |
)
|
398 |
await db.backup_chatbot.update_one(
|
|
|
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:
|
|
|
921 |
{"$set": {"prompt_image": query_base}},
|
922 |
upsert=True
|
923 |
)
|
924 |
+
await message.reply_photo(
|
925 |
+
photo="loading.jpg",
|
926 |
+
caption="Are you sure you want to prompt this Image generate?",
|
927 |
reply_markup=InlineKeyboardMarkup(buttons)
|
928 |
)
|
929 |
return
|