Add show_bridge_link configuration option and update post parsing to include bridge link in message links
This commit is contained in:
@@ -18,4 +18,5 @@ def get_settings():
|
||||
"debug": os.getenv("DEBUG", "False") == "True",
|
||||
"token": os.getenv("TOKEN", ""),
|
||||
"time_based_merge": os.getenv("TIME_BASED_MERGE", "False").strip() in ["True", "true"],
|
||||
"show_bridge_link": os.getenv("SHOW_BRIDGE_LINK", "False").strip() in ["True", "true"],
|
||||
}
|
||||
|
||||
@@ -509,13 +509,19 @@ class PostParser:
|
||||
channel_identifier = self.get_channel_username(message)
|
||||
if channel_identifier:
|
||||
links = []
|
||||
base_url = Config['pyrogram_bridge_url']
|
||||
|
||||
if channel_identifier.startswith('-100'): # For channels with only ID
|
||||
channel_id = channel_identifier[4:] # Remove '-100' prefix for web links
|
||||
links.append(f'<a href="tg://resolve?domain=c/{channel_id}&post={message.id}">Open in Telegram</a>')
|
||||
links.append(f'<a href="https://t.me/c/{channel_id}/{message.id}">Open in Web</a>')
|
||||
if Config['show_bridge_link']:
|
||||
links.append(f'<a href="{base_url}/html/{channel_identifier}/{message.id}">Open in Bridge</a>')
|
||||
else: # For channels with username
|
||||
links.append(f'<a href="tg://resolve?domain={channel_identifier}&post={message.id}">Open in Telegram</a>')
|
||||
links.append(f'<a href="https://t.me/{channel_identifier}/{message.id}">Open in Web</a>')
|
||||
if Config['show_bridge_link']:
|
||||
links.append(f'<a href="{base_url}/html/{channel_identifier}/{message.id}">Open in Bridge</a>')
|
||||
second_line_parts.extend(links)
|
||||
|
||||
if second_line_parts:
|
||||
|
||||
Reference in New Issue
Block a user