Get live messages from channel using Telethon

28 views Asked by At

I am trying to get live messages from channels using telethon, I tried many things I found on the internet, but nothing works. I have done this:

from telethon import TelegramClient, events

api_id = 123456789
api_hash = "xxx"
bot_token = 'xxx'
client = TelegramClient('anon', api_id, api_hash)
@client.on(events.NewMessage(chats=["@TelethonUpdates","@TrustPad"]))
async def my_event_handler(event):
    print(event.chat.name, ':', event.text)
client.start(bot_token=bot_token)
client.run_until_disconnected()

But I get no messages from "TrustPad" for instance. Any idea what I miss please?

0

There are 0 answers