|
| 1 | +from pyrogram import Client, filters |
| 2 | +from bot import Bot |
| 3 | +from config import CHANNEL_ID |
| 4 | + |
| 5 | +@Bot.on_message(filters.private & filters.user(ADMINS) & filters.command('batch')) |
| 6 | +async def batch(client: Client, message: Message): |
| 7 | + while True: |
| 8 | + try: |
| 9 | + first_message = await client.ask(text = "Forward the First Message from the DB Channel (with Quotes)..", chat_id = message.from_user.id, filters=filters.forwarded, timeout=30) |
| 10 | + except: |
| 11 | + return |
| 12 | + if first_message.forward_from_chat: |
| 13 | + if first_message.forward_from_chat.id == CHANNEL_ID: |
| 14 | + f_msg_id = first_message.forward_from_message_id |
| 15 | + break |
| 16 | + await first_message.reply_text("Forward from the Assigned Channel only...", quote = True) |
| 17 | + continue |
| 18 | + while True: |
| 19 | + try: |
| 20 | + second_message = await client.ask(text = "Forward the Last Message from DB Channel (with Quotes)..", chat_id = message.from_user.id, filters=filters.forwarded, timeout=30) |
| 21 | + except: |
| 22 | + return |
| 23 | + if second_message.forward_from_chat: |
| 24 | + if second_message.forward_from_chat.id == CHANNEL_ID: |
| 25 | + s_msg_id = second_message.forward_from_message_id |
| 26 | + break |
| 27 | + await second_message.reply_text("Forward from the Assigned Channel only...", quote = True) |
| 28 | + continue |
| 29 | + |
| 30 | + string = f"get-{f_msg_id * abs(CHANNEL_ID)}-{s_msg_id * abs(CHANNEL_ID)}" |
| 31 | + base64_string = await encode(string) |
| 32 | + link = f"https://t.me/{client.username}?start={base64_string}" |
| 33 | + reply_markup = InlineKeyboardMarkup([[InlineKeyboardButton("🔁 Share URL", url=f'https://telegram.me/share/url?url={link}')]]) |
| 34 | + await second_message.reply_text(f"<b>Here is your link</b>\n\n{link}", quote=True, reply_markup=reply_markup) |
0 commit comments