mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-02-02 20:54:43 +03:00
Process self-produced updates like any other
This commit is contained in:
parent
1f40372235
commit
f1a517dee6
|
@ -771,3 +771,5 @@ sequential_updates is gone
|
|||
connection type is gone
|
||||
|
||||
raise_last_call_error is now the default rather than ValueError
|
||||
|
||||
self-produced updates like getmessage now also trigger a handler
|
||||
|
|
|
@ -603,6 +603,7 @@ class MTProtoSender:
|
|||
if not state.future.cancelled():
|
||||
state.future.set_exception(e)
|
||||
else:
|
||||
self._store_own_updates(result)
|
||||
if not state.future.cancelled():
|
||||
state.future.set_result(result)
|
||||
|
||||
|
@ -646,6 +647,20 @@ class MTProtoSender:
|
|||
)
|
||||
self._last_update_warn = now
|
||||
|
||||
def _store_own_updates(self, obj, *, _update_ids=frozenset((
|
||||
_tl.UpdateShortMessage.CONSTRUCTOR_ID,
|
||||
_tl.UpdateShortChatMessage.CONSTRUCTOR_ID,
|
||||
_tl.UpdateShort.CONSTRUCTOR_ID,
|
||||
_tl.UpdatesCombined.CONSTRUCTOR_ID,
|
||||
_tl.Updates.CONSTRUCTOR_ID,
|
||||
_tl.UpdateShortSentMessage.CONSTRUCTOR_ID,
|
||||
))):
|
||||
try:
|
||||
if obj.CONSTRUCTOR_ID in _update_ids:
|
||||
self._updates_queue.put_nowait(obj)
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
async def _handle_pong(self, message):
|
||||
"""
|
||||
Handles pong results, which don't come inside a ``rpc_result``
|
||||
|
|
Loading…
Reference in New Issue
Block a user