mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-26 19:33:45 +03:00
Expand Updates into Update objects before calling handlers
This commit is contained in:
parent
c61e168de4
commit
1ded6d9d06
|
@ -141,5 +141,29 @@ class UpdateState:
|
|||
return # We already handled this update
|
||||
|
||||
self._state.pts = pts
|
||||
self._updates.append(update)
|
||||
self._updates_available.set()
|
||||
|
||||
if type(update).SUBCLASS_OF_ID == 0x8af52aac: # crc32(b'Updates')
|
||||
# Expand "Updates" into "Update", and pass these to callbacks.
|
||||
# Since .users and .chats have already been processed, we
|
||||
# don't need to care about those either.
|
||||
if isinstance(update, tl.UpdateShort):
|
||||
self._updates.append(update.update)
|
||||
self._updates_available.set()
|
||||
|
||||
elif isinstance(update, tl.Updates) or \
|
||||
isinstance(update, tl.UpdatesCombined):
|
||||
self._updates.extend(update.updates)
|
||||
self._updates_available.set()
|
||||
|
||||
elif not isinstance(update, tl.UpdatesTooLong):
|
||||
# TODO Handle "Updates too long"
|
||||
self._updates.append(update)
|
||||
self._updates_available.set()
|
||||
|
||||
elif type(update).SUBCLASS_OF_ID == 0x9f89304e: # crc32(b'Update')
|
||||
self._updates.append(update)
|
||||
self._updates_available.set()
|
||||
else:
|
||||
self._logger.debug('Ignoring "update" of type {}'.format(
|
||||
type(update).__name__)
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue
Block a user