|
5 | 5 | from pyrogram.errors import FloodWait |
6 | 6 |
|
7 | 7 | from bot import Bot |
8 | | -from config import ADMINS, CHANNEL_ID |
| 8 | +from config import ADMINS |
9 | 9 | from helper_func import encode |
10 | 10 |
|
11 | 11 | @Bot.on_message(filters.private & filters.user(ADMINS) & ~filters.command(['start','batch','genlink'])) |
12 | 12 | async def channel_post(client: Client, message: Message): |
13 | 13 | reply_text = await message.reply_text("Please Wait...!", quote = True) |
14 | 14 | try: |
15 | | - post_message = await message.copy(chat_id = CHANNEL_ID, disable_notification=True) |
| 15 | + post_message = await message.copy(chat_id = client.db_channel.id, disable_notification=True) |
16 | 16 | except FloodWait as e: |
17 | 17 | await asyncio.sleep(e.x) |
18 | | - post_message = await message.copy(chat_id = CHANNEL_ID, disable_notification=True) |
| 18 | + post_message = await message.copy(chat_id = client.db_channel.id, disable_notification=True) |
19 | 19 | except Exception as e: |
20 | 20 | print(e) |
21 | 21 | await reply_text.edit_text("Something went Wrong..!") |
22 | 22 | return |
23 | | - converted_id = post_message.message_id * abs(CHANNEL_ID) |
| 23 | + converted_id = post_message.message_id * abs(client.db_channel.id) |
24 | 24 | string = f"get-{converted_id}" |
25 | 25 | base64_string = await encode(string) |
26 | 26 | link = f"https://t.me/{client.username}?start={base64_string}" |
27 | 27 | reply_markup = InlineKeyboardMarkup([[InlineKeyboardButton("🔁 Share URL", url=f'https://telegram.me/share/url?url={link}')]]) |
28 | 28 | await reply_text.edit(f"<b>Here is your link</b>\n\n{link}", reply_markup=reply_markup, disable_web_page_preview = True) |
29 | 29 |
|
30 | | -@Bot.on_message(filters.channel & filters.incoming & filters.chat(CHANNEL_ID)) |
| 30 | +@Bot.on_message(filters.channel & filters.incoming & filters.chat(client.db_channel.id)) |
31 | 31 | async def new_post(client: Client, message: Message): |
32 | | - converted_id = message.message_id * abs(CHANNEL_ID) |
| 32 | + converted_id = message.message_id * abs(client.db_channel.id) |
33 | 33 | string = f"get-{converted_id}" |
34 | 34 | base64_string = await encode(string) |
35 | 35 | link = f"https://t.me/{client.username}?start={base64_string}" |
|
0 commit comments