pythontelegramtelethon

How get url of new message (channel/group) in telethon Telegram


I need to get url of new message Telegram, Python, Telethon

url - the link to telegram channel/group on this message

i use this code to handle new messages, how get url?

from telethon import events

@client.on(events.NewMessage())
async def handler(event: events.NewMessage.Event):
print(event.message.message) # printing text of received message

Solution

  • Try https://t.me/c/{event.chat.id}/{event.message.id}