Update chatbot/plugins/chat.py
Browse files- chatbot/plugins/chat.py +21 -0
chatbot/plugins/chat.py
CHANGED
@@ -282,6 +282,26 @@ async def deletemydata(client, callback):
|
|
282 |
else:
|
283 |
await callback.answer(delm, True)
|
284 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
285 |
@Client.on_callback_query(filters.regex("^genprompt_(\d+)$"))
|
286 |
async def geminigen_prompt(client, callback):
|
287 |
user_id = int(callback.matches[0].group(1))
|
@@ -401,6 +421,7 @@ async def flux_prompt(client, callback):
|
|
401 |
),
|
402 |
reply_markup=keyboard
|
403 |
)
|
|
|
404 |
await db.backup_chatbot.update_one(
|
405 |
{"user_id": user_id},
|
406 |
{"$set": {"translate_text": response.text}},
|
|
|
282 |
else:
|
283 |
await callback.answer(delm, True)
|
284 |
|
285 |
+
@Client.on_callback_query(filters.regex("^autopost_(\d+)$"))
|
286 |
+
async def auto_post(client, callback):
|
287 |
+
user_id = int(callback.matches[0].group(1))
|
288 |
+
try:
|
289 |
+
backup_chat = await db._get_chatbot_chat_from_db(user_id)
|
290 |
+
data = await db.backup_chatbot.find_one({"user_id": user_id})
|
291 |
+
if not data:
|
292 |
+
return await callback.answer("Can't found user", True)
|
293 |
+
file_id = data.get("file_id", None)
|
294 |
+
if data.get("is_channel_photo", False):
|
295 |
+
if not file_id:
|
296 |
+
return await callback.answer("Can't found file_id", True)
|
297 |
+
await client.send_photo(
|
298 |
+
data.get("channel_id"),
|
299 |
+
photo=file_id,
|
300 |
+
caption=caption
|
301 |
+
)
|
302 |
+
except Exception as e:
|
303 |
+
LOGS.error(f"auto_post failed: {str(e)}")
|
304 |
+
|
305 |
@Client.on_callback_query(filters.regex("^genprompt_(\d+)$"))
|
306 |
async def geminigen_prompt(client, callback):
|
307 |
user_id = int(callback.matches[0].group(1))
|
|
|
421 |
),
|
422 |
reply_markup=keyboard
|
423 |
)
|
424 |
+
# photo = await client.send_photo("@xpushz", file_path)
|
425 |
await db.backup_chatbot.update_one(
|
426 |
{"user_id": user_id},
|
427 |
{"$set": {"translate_text": response.text}},
|