有没有办法在电视节目中发送“用户输入...”状态?

问题描述 投票:0回答:1

我想向他们(收件人)方面的实体发送更新,该实体将显示为“X正在输入...”(X是我)。我查看了文档(特别是在telethon.client包下)并找不到这样做的方法。是否可以使用telethon发送这样的更新?

python telegram telethon
1个回答
1
投票

你正在寻找的功能是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

© www.soinside.com 2019 - 2024. All rights reserved.