diff --git a/telethon/sessions/memory.py b/telethon/sessions/memory.py index 43ddde4b..e5223cac 100644 --- a/telethon/sessions/memory.py +++ b/telethon/sessions/memory.py @@ -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): diff --git a/telethon/telegram_client.py b/telethon/telegram_client.py index 937540da..e35b996c 100644 --- a/telethon/telegram_client.py +++ b/telethon/telegram_client.py @@ -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,