Process entities from the MtProtoSender instead TelegramBareClient

This way, update objects will also be processed when they occur.
This commit is contained in:
Lonami Exo
2017-10-01 16:02:29 +02:00
parent 71b6e527a6
commit 36dabc4928
3 changed files with 26 additions and 25 deletions

View File

@@ -494,21 +494,10 @@ class TelegramBareClient:
# rejected by the other party as a whole."
return None
# Save all input entities we know of
entities = []
results = []
for x in requests:
y = x.result
results.append(y)
if hasattr(y, 'chats') and hasattr(y.chats, '__iter__'):
entities.extend(y.chats)
if hasattr(y, 'users') and hasattr(y.users, '__iter__'):
entities.extend(y.users)
if self.session.add_entities(entities):
self.session.save() # Save if any new entities got added
return results[0] if len(results) == 1 else results
if len(requests) == 1:
return requests[0].result
else:
return [x.result for x in requests]
except (PhoneMigrateError, NetworkMigrateError,
UserMigrateError) as e: