LonamiWebs / Telethon

Pure Python 3 MTProto API Telegram client library, for bots too!

Home Page:https://docs.telethon.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to set timeout between parallel requests to Telegram servers?

pwd491 opened this issue · comments

Describe your suggested feature

await client([
    SendMessageRequest('me', 'Hello'),
    # need to 10 sec timeout
    SendMessageRequest('me', ', '),
    # need to 10 sec timeout
    SendMessageRequest('me', 'World'),
    # need to 10 sec timeout
    SendMessageRequest('me', '.')
], ordered=True)

Checklist

  • I have searched for this issue before posting it and there isn't a duplicate.

I do not have plans to support this. It would require a fairly large refactoring of the library to cleanly implement this, which I'm not really willing to do.

If you want to support it in your own fork of the library, you will need to use https://github.com/telegramdesktop/tdesktop/blob/84ec2a5f7494ffc2516ecc78ef89aba3da199b33/Telegram/SourceFiles/mtproto/scheme/mtproto.tl#L118 with the msg_id assigned deep in the internals of the library (that is not the message identifier of the text message you're sending, but the protocol message used to contain the request).