From 534b0800addfbfe1f63f229c75f64447e15fb0b3 Mon Sep 17 00:00:00 2001 From: Christian Stemmle Date: Sun, 1 Oct 2017 13:37:15 +0200 Subject: [PATCH] Make find_user_or_chat work for message.id again --- telethon/utils.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/telethon/utils.py b/telethon/utils.py index 273dc962..543e7e0a 100644 --- a/telethon/utils.py +++ b/telethon/utils.py @@ -304,12 +304,16 @@ def find_user_or_chat(peer, users, chats): Returns None if it was not found""" if isinstance(peer, PeerUser): peer, where = peer.user_id, users + elif isinstance(peer, PeerChat): + peer, where = peer.chat_id, chats + elif isinstance(peer, PeerChannel): + peer, where = peer.channel_id, chats else: - where = chats - if isinstance(peer, PeerChat): - peer = peer.chat_id - elif isinstance(peer, PeerChannel): - peer = peer.channel_id + if isinstance(users, dict) and isinstance(chats, dict): + where = users + where.update(chats) + else: + where = users + chats if isinstance(peer, int): if isinstance(where, dict):