Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to send "User is typing..." status in telethon?

I wanted to send an update to an entity that will show up as "X is typing..." (X being me) on their (recipient's) side. I've looked through the docs (especially under the telethon.client package) and couldn't find a method that does that. Is it possible to send such an update using telethon?

like image 347
Kidus Avatar asked Oct 26 '25 07:10

Kidus


1 Answers

The function you are looking for is SetTypingRequest. Read more about it here:

https://lonamiwebs.github.io/Telethon/methods/messages/set_typing.html

Example:

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)

Don't forget to cancel the typing action after some time; you probably don't want to type forever :-D

https://lonamiwebs.github.io/Telethon/constructors/send_message_cancel_action.html

like image 154
Ali Hashemi Avatar answered Oct 28 '25 20:10

Ali Hashemi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!