Fix _handle_update not expanding Updates

This commit is contained in:
Lonami Exo 2018-06-14 22:51:57 +02:00
parent 179af9894f
commit c788e17c22

View File

@ -1,4 +1,5 @@
import asyncio import asyncio
import itertools
import logging import logging
import warnings import warnings
@ -144,6 +145,17 @@ class UpdateMethods(UserMethods):
# region Private methods # region Private methods
def _handle_update(self, update): def _handle_update(self, update):
if isinstance(update, (types.Updates, types.UpdatesCombined)):
entities = {utils.get_peer_id(x): x for x in
itertools.chain(update.users, update.chats)}
for u in update.updates:
u._entities = entities
asyncio.ensure_future(
self._dispatch_update(u), loop=self._loop)
return
if isinstance(update, types.UpdateShort):
update = update.update
update._entities = {}
asyncio.ensure_future(self._dispatch_update(update), loop=self._loop) asyncio.ensure_future(self._dispatch_update(update), loop=self._loop)
async def _dispatch_update(self, update): async def _dispatch_update(self, update):