Support async def in sessions (#1013)

This commit is contained in:
josephbiko
2018-10-05 20:25:49 +02:00
committed by Lonami
parent 653f3c043d
commit 3dd8b7c6d1
10 changed files with 49 additions and 28 deletions

View File

@@ -48,7 +48,7 @@ class UserMethods(TelegramBaseClient):
exceptions.append(e)
results.append(None)
continue
self.session.process_entities(result)
await self.session.process_entities(result)
exceptions.append(None)
results.append(result)
request_index += 1
@@ -58,7 +58,7 @@ class UserMethods(TelegramBaseClient):
return results
else:
result = await future
self.session.process_entities(result)
await self.session.process_entities(result)
return result
except (errors.ServerError, errors.RpcCallFailError) as e:
__log__.warning('Telegram is having internal issues %s: %s',
@@ -288,7 +288,7 @@ class UserMethods(TelegramBaseClient):
try:
# First try to get the entity from cache, otherwise figure it out
return self.session.get_input_entity(peer)
return await self.session.get_input_entity(peer)
except ValueError:
pass
@@ -393,7 +393,7 @@ class UserMethods(TelegramBaseClient):
try:
# Nobody with this username, maybe it's an exact name/title
return await self.get_entity(
self.session.get_input_entity(string))
await self.session.get_input_entity(string))
except ValueError:
pass