0

去年,我用 Telethon 库开发了一个 GATE:

https://github.com/LonamiWebs/Telethon

门在更多客户端和 Telegram 服务器之间工作。它工作得很好。目前它不起作用。在我的代码中,它创建了一个连接到电报服务器的线程。在这个线程的run()函数中,它调用了方法:

self.client.add_update_handler(self.update_handler)

然后 Thread 中的方法 update_handler 管理更新...

现在,错误如下:

self.client.add_update_handler(self.update_handler)
AttributeError: 'TelegramClient' object has no attribute 'add_update_handler'

为什么?

4

1 回答 1

2

根据 Telethon 变更日志:

# 4. client.add_update_handler no longer exists.
# Change this...
client.add_update_handler(handler)
# ...to this:
client.add_event_handler(handler)
于 2019-05-17T09:04:21.607 回答