Skip to content

Commit 4a7e988

Browse files
authored
Update channel_post.py
1 parent f8cb209 commit 4a7e988

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

plugins/channel_post.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from pyrogram.errors import FloodWait
77

88
from bot import Bot
9-
from config import ADMINS, CHANNEL_ID
9+
from config import ADMINS, CHANNEL_ID, DISABLE_CHANNEL_BUTTON
1010
from helper_func import encode
1111

1212
@Bot.on_message(filters.private & filters.user(ADMINS) & ~filters.command(['start','batch','genlink']))
@@ -25,12 +25,21 @@ async def channel_post(client: Client, message: Message):
2525
string = f"get-{converted_id}"
2626
base64_string = await encode(string)
2727
link = f"https://t.me/{client.username}?start={base64_string}"
28-
reply_markup = InlineKeyboardMarkup([[InlineKeyboardButton("🔁 Share URL", url=f'https://telegram.me/share/url?url={link}')]])
28+
29+
if DISABLE_CHANNEL_BUTTON:
30+
reply_markup = message.reply_markup
31+
else:
32+
reply_markup = InlineKeyboardMarkup([[InlineKeyboardButton("🔁 Share URL", url=f'https://telegram.me/share/url?url={link}')]])
33+
2934
await reply_text.edit(f"<b>Here is your link</b>\n\n{link}", reply_markup=reply_markup, disable_web_page_preview = True)
3035
await post_message.edit_reply_markup(reply_markup)
3136

3237
@Bot.on_message(filters.channel & filters.incoming & filters.chat(CHANNEL_ID) & ~filters.edited)
3338
async def new_post(client: Client, message: Message):
39+
40+
if not DISABLE_CHANNEL_BUTTON:
41+
return
42+
3443
converted_id = message.message_id * abs(client.db_channel.id)
3544
string = f"get-{converted_id}"
3645
base64_string = await encode(string)

0 commit comments

Comments
 (0)