From d1fadf01ce47beb08396652c675581e2929e7013 Mon Sep 17 00:00:00 2001 From: Gagan Date: Sat, 16 Mar 2024 07:45:55 +0530 Subject: [PATCH] Update pyroplug.py --- main/plugins/pyroplug.py | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index defbe2c4..8c93e636 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -22,12 +22,21 @@ logging.getLogger("pyrogram").setLevel(logging.INFO) logging.getLogger("telethon").setLevel(logging.INFO) +user_chat_ids = {} + def thumbnail(sender): return f'{sender}.jpg' if os.path.exists(f'{sender}.jpg') else f'thumb.jpg' -# Define a dictionary to store user chat IDs -user_chat_ids = {} +async def copy_message_with_chat_id(client, sender, chat_id, message_id): + # Get the user's set chat ID, if available; otherwise, use the original sender ID + target_chat_id = user_chat_ids.get(sender, sender) + await client.copy_message(target_chat_id, chat_id, message_id) +async def send_message_with_chat_id(client, sender, message, parse_mode=None): + # Get the user's set chat ID, if available; otherwise, use the original sender ID + chat_id = user_chat_ids.get(sender, sender) + await client.send_message(chat_id, message, parse_mode=parse_mode) + @bot.on(events.NewMessage(incoming=True, pattern='/setchat')) async def set_chat_id(event): # Extract chat ID from the message @@ -144,26 +153,26 @@ async def get_msg(userbot, client, sender, edit_id, msg_link, i, file_n): a = b = True edit = await client.edit_message_text(sender, edit_id, "Cloning.") if '--' in msg.text.html or '**' in msg.text.html or '__' in msg.text.html or '~~' in msg.text.html or '||' in msg.text.html or '```' in msg.text.html or '`' in msg.text.html: - await client.send_message(sender, msg.text.html, parse_mode=ParseMode.HTML) + await send_message_with_chat_id(client, sender, msg.text.html, parse_mode=ParseMode.HTML) a = False if '' in msg.text.markdown or '' in msg.text.markdown or '' in msg.text.markdown or '' in msg.text.markdown or '' in msg.text.markdown or '' in msg.text.markdown or '' in msg.text.markdown or '' in msg.text.markdown or '' in msg.text.markdown or '' in msg.text.markdown or '' in msg.text.markdown or '' in msg.text.markdown or '' in msg.text.markdown or '' in msg.text.markdown or '' in msg.text.markdown or '' in msg.text.markdown or '