|
6 | 6 | from pyrogram.errors import FloodWait |
7 | 7 |
|
8 | 8 | from bot import Bot |
9 | | -from config import ADMINS, START_MSG, OWNER_ID |
| 9 | +from config import ADMINS, START_MSG, OWNER_ID, CUSTOM_CAPTION, DISABLE_CHANNEL_BUTTON |
10 | 10 | from helper_func import subscribed, encode, decode, get_messages |
11 | 11 |
|
12 | 12 | @Bot.on_message(filters.command('start') & filters.private & subscribed) |
@@ -47,13 +47,25 @@ async def start_command(client: Client, message: Message): |
47 | 47 | await message.reply_text("Something went wrong..!") |
48 | 48 | return |
49 | 49 | await temp_msg.delete() |
| 50 | + |
50 | 51 | for msg in messages: |
| 52 | + |
| 53 | + if bool(CUSTOM_CAPTION) & bool(msg.document): |
| 54 | + caption = CUSTOM_CAPTION.format(previouscaption = "" if not msg.caption else msg.caption.html, filename = msg.document.file_name) |
| 55 | + else: |
| 56 | + caption = "" if not msg.caption else msg.caption.html |
| 57 | + |
| 58 | + if DISABLE_CHANNEL_BUTTON: |
| 59 | + reply_markup = msg.reply_markup |
| 60 | + else: |
| 61 | + reply_markup = None |
| 62 | + |
51 | 63 | try: |
52 | | - await msg.copy(chat_id=message.from_user.id, reply_markup = None) |
| 64 | + await msg.copy(chat_id=message.from_user.id, caption = caption, parse_mode = 'html', reply_markup = reply_markup) |
53 | 65 | await asyncio.sleep(0.5) |
54 | 66 | except FloodWait as e: |
55 | 67 | await asyncio.sleep(e.x) |
56 | | - await msg.copy(chat_id=message.from_user.id, reply_markup = None) |
| 68 | + await msg.copy(chat_id=message.from_user.id, caption = caption, parse_mode = 'html', reply_markup = reply_markup) |
57 | 69 | except: |
58 | 70 | pass |
59 | 71 | return |
|
0 commit comments