File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change 1+ import asyncio
2+ from pyrogram import filters , Client
3+ from pyrogram .types import Message , InlineKeyboardMarkup , InlineKeyboardButton
4+ from pyrogram .errors import FloodWait
5+
6+ from bot import Bot
7+ from config import ADMINS , CHANNEL_ID
8+ from helper_func import encode
9+
10+ @Bot .on_message (filters .private & filters .user (ADMINS ) & ~ filters .command (['start' ,'batch' ]))
11+ async def channel_post (client : Client , message : Message ):
12+ reply_text = await message .reply_text ("Please Wait...!" , quote = True )
13+ try :
14+ post_message = await message .copy (chat_id = CHANNEL_ID , disable_notification = True )
15+ except FloodWait as e :
16+ await asyncio .sleep (e .x )
17+ post_message = await message .copy (chat_id = CHANNEL_ID , disable_notification = True )
18+ except Exception as e :
19+ print (e )
20+ await reply_text .edit_text ("Something went Wrong..!" )
21+ return
22+ converted_id = post_message .message_id * abs (CHANNEL_ID )
23+ string = f"get-{ converted_id } "
24+ base64_string = await encode (string )
25+ link = f"https://t.me/{ client .username } ?start={ base64_string } "
26+ reply_markup = InlineKeyboardMarkup ([[InlineKeyboardButton ("🔁 Share URL" , url = f'https://telegram.me/share/url?url={ link } ' )]])
27+ await reply_text .edit (f"<b>Here is your link</b>\n \n { link } " , reply_markup = reply_markup , disable_web_page_preview = True )
You can’t perform that action at this time.
0 commit comments