我想向他们(收件人)方面的实体发送更新,该实体将显示为“X正在输入...”(X是我)。我查看了文档(特别是在telethon.client
包下)并找不到这样做的方法。是否可以使用telethon发送这样的更新?
你正在寻找的功能是SetTypingRequest
。在这里阅读更多相关信息:
https://lonamiwebs.github.io/Telethon/methods/messages/set_typing.html
例:
from telethon.sync import TelegramClient
from telethon import functions, types
with TelegramClient(name, api_id, api_hash) as client:
result = client(functions.messages.SetTypingRequest(
peer='username',
action=types.SendMessageTypingAction()
))
print(result)
一段时间后不要忘记取消打字动作;你可能不想永远打字:-D
https://lonamiwebs.github.io/Telethon/constructors/send_message_cancel_action.html