簡體   English   中英

問題Telethon python庫-(TELEGRAM)

[英]PROBLEM Telethon python library - (TELEGRAM)

去年,我開發了帶有Telethon庫的GATE:

https://github.com/LonamiWebs/Telethon

門在更多客戶端和Telegram服務器之間起作用。 效果很好。 目前,它不起作用。 在我的代碼中,它創建了一個連接到電報服務器的線程。 在此線程的run()函數中,它調用方法:

self.client.add_update_handler(self.update_handler)

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

現在,錯誤如下:

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

為什么?

根據Telethon更改日志:

# 4. client.add_update_handler no longer exists.
# Change this...
client.add_update_handler(handler)
# ...to this:
client.add_event_handler(handler)

非常感謝您的支持。 我使用了以下代碼:

class TelegramUser(Thread):
def __init__(self,client):
    Thread.__init__(self)
    ......
    ......       

def run(self):
    ....
    ....
    self.telegramClient.add_event_handler(self.handler)
    ....

def handler(self, events):
    #manage the update....

問題如下:

引發TypeError('asyncio.Future,協程或等待的是'TypeError:需要asyncio.Future,協程或等待的

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM