Fix-up bot API style IDs not working on .get_input_entity

This commit is contained in:
Lonami Exo 2018-03-08 10:12:43 +01:00
parent 0f34a9b333
commit 3a3ae75b46
2 changed files with 4 additions and 3 deletions

View File

@ -177,7 +177,7 @@ class MemorySession(Session):
key = utils.get_peer_id(key)
exact = True
else:
exact = False
exact = not isinstance(key, int) or key < 0
result = None
if isinstance(key, str):

View File

@ -2285,9 +2285,10 @@ class TelegramClient(TelegramBareClient):
'Cannot turn "{}" into an input entity.'.format(original_peer)
)
# Add the mark to the peers if the user passed a Peer (not an int)
# Add the mark to the peers if the user passed a Peer (not an int),
# or said ID is negative. If it's negative it's been marked already.
# Look in the dialogs with the hope to find it.
mark = not isinstance(peer, int)
mark = not isinstance(peer, int) or peer < 0
target_id = utils.get_peer_id(peer)
req = GetDialogsRequest(
offset_date=None,