为什么 Telethon cleint.get_entity(id) 打印错误 "missing argument: 'entity'"?

Why Telethon cleint.get_entity(id) print error "missing argument: 'entity'"?

我尝试通过该代码中的 ID 进行聊天,例如 api:

from telethon import TelegramClient
import secret
client = TelegramClient('opentfd_session', secret.api_id, secret.api_hash).start()
chat_admin = TelegramClient.get_entity(secret.chat_id)

我收到错误:

Traceback (most recent call last):
  File "C:\Users\krutm\Documents\opentfd\opentfd.py", line 23, in <module>
    chat_admin = TelegramClient.get_entity(secret.chat_id)
  File "C:\Users\krutm\Documents\opentfd\venv\lib\site-packages\telethon\sync.py", line 34, in syncified
    coro = method(*args, **kwargs)
TypeError: get_entity() missing 1 required positional argument: 'entity'

我不明白什么实体,如果我需要从这个方法中获取实体。我该怎么办?

阅读 telethon 文档会对您有更多帮助。您甚至不具备有关客户的基本知识。顺便说一句,该方法使用如下:

await client.get_entity(id/username/link)