Telethon icon indicating copy to clipboard operation
Telethon copied to clipboard

AttributeError: 'TelegramClient' object has no attribute '_event_builders'

Open yairp03 opened this issue 3 years ago • 3 comments

I'm using Telethon v2 and I'm getting this exception:

Code

from telethon import TelegramClient
from telethon.events import NewMessage

api_id = 000
api_hash = '000'
channel_id = -100000

client = TelegramClient('test', api_id, api_hash)

@client.on(NewMessage(channel_id))
async def callback(event):
    print(event)

Traceback

Traceback (most recent call last):
  File "code.py", line 11, in <module>
    async def callback(event):
  File "venv\lib\site-packages\telethon\_client\updates.py", line 38, in decorator
    self.add_event_handler(f, event)
  File "venv\lib\site-packages\telethon\_client\updates.py", line 58, in add_event_handler
    self._event_builders.append((event, callback))
AttributeError: 'TelegramClient' object has no attribute '_event_builders'

yairp03 avatar Jan 25 '22 23:01 yairp03

Also, somehow, I needed to install markdown-it-py by myself cause it didn't consider it as a requirement, so maybe something was wrong with the way I installed Telethon v2?

yairp03 avatar Jan 25 '22 23:01 yairp03

v2 is still in the works and pretty much not ready for use yet (it's missing a few changes and then a lot of testing and docs updates).

Lonami avatar Jan 26 '22 00:01 Lonami

So the update for restricted contect channels is irrelevant at the moment? Cause this is why I tried to update to v2

yairp03 avatar Jan 26 '22 15:01 yairp03

Closing since v2 is not yet ready for public use, and this error should not be present in the currently-published v1.25 available from PyPi.

Lonami avatar Sep 20 '22 16:09 Lonami