Move me/self check on get_input_entity to the beginning

It would otherwise fail since the addition of getting entity
by exact name if someone had 'me' or 'self' as their name.
This commit is contained in:
Lonami Exo 2018-03-27 11:29:47 +02:00
parent 8d652c35a1
commit 7b94530bfc

View File

@ -2425,6 +2425,9 @@ class TelegramClient(TelegramBareClient):
Returns:
:tl:`InputPeerUser`, :tl:`InputPeerChat` or :tl:`InputPeerChannel`.
"""
if peer in ('me', 'self'):
return InputPeerSelf()
try:
# First try to get the entity from cache, otherwise figure it out
return self.session.get_input_entity(peer)
@ -2432,8 +2435,6 @@ class TelegramClient(TelegramBareClient):
pass
if isinstance(peer, str):
if peer in ('me', 'self'):
return InputPeerSelf()
return utils.get_input_peer(self._get_entity_from_string(peer))
original_peer = peer