Use EntityDatabase on TelegramClient.get_entity instead lru_cache

This commit is contained in:
Lonami Exo
2017-10-05 12:27:05 +02:00
parent a0fc5ed54e
commit e5c4df98df
2 changed files with 62 additions and 55 deletions

View File

@@ -130,6 +130,12 @@ class EntityDatabase:
# TODO Allow search by name by tokenizing the input and return a list
def get_input_entity(self, peer):
try:
return self._input_entities[utils.get_peer_id(peer, add_mark=True)]
except ValueError as e:
raise KeyError(peer) from e
def get_input_list(self):
return list(self._input_entities.items())