Search code examples
pythontelethon

Telethon events.NewMessage() doesn't work


I try to catch new messages in 4 certain channels, but not all channels work. If I write to account from my second account - script works. If there is new message in some channel - script doesn't see the event at all.

from telethon.sync import TelegramClient, events

api_id = 11111
api_hash = 'fjnbkdnslkfnbksbs'
client = TelegramClient('test', api_id, api_hash)
client.start()


@client.on(events.NewMessage())
async def handle(event):
    print('I see the message')


client.run_until_disconnected()

What is the problem?


Solution

  • Answer was pretty simple. I needed to upgrade telethon using pip install --upgrade telethon