grammers icon indicating copy to clipboard operation
grammers copied to clipboard

"SetTypingRequest" Telethon equivalent in Gramme.rs

Open foodornt opened this issue 4 years ago • 7 comments

Is there any?

foodornt avatar Oct 18 '21 08:10 foodornt

Currently there is no "friendly method" for it. We should brainstorm how this should work in grammers. In Telethon, we can use a context manager, and the typing status is sent for as long as the context manager is open. But Rust doesn't have that. We could emulate one with a closure, but I don't know if that's the best option. What ideas do you have, or how would you like to use it?

Lonami avatar Oct 18 '21 12:10 Lonami

Personally I'd just emulate it manually for n amount of time

foodornt avatar Oct 19 '21 06:10 foodornt

Could you sketch some code on how you'd imagine it? Then we can discuss tradeoffs.

Lonami avatar Oct 19 '21 16:10 Lonami

maybe something like:

client.set_typing_status(chat_id, true);

🤷🏻‍♂️

foodornt avatar Oct 20 '21 13:10 foodornt

This will only show it for a few seconds. It would be annoying to use, with, say, file uploads, which need to send this request evwry so often (but there's no need to do it too often).

Lonami avatar Oct 20 '21 16:10 Lonami

oh sorry didn't know telegram does it this way

What about keep sending it until the library user set it to false?

foodornt avatar Oct 20 '21 18:10 foodornt

Then not only does the library have to spawn a long-lived task (which I would rather avoid), but it would also make it easy to accidentally always leave it on.

Lonami avatar Oct 20 '21 21:10 Lonami