From c9ecd61f7e4d3939040441886dc54f14ef7fea69 Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Wed, 1 Dec 2021 19:03:38 +0100 Subject: [PATCH] Fix peer ID check to work with higher IDs This commit is taken from https://github.com/tulir/Telethon/commit/5f4bfe6b9be9da6d7ef0a55c67b7cc1cfd142fe2 --- telethon/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/telethon/utils.py b/telethon/utils.py index e8c59c01..7d058518 100644 --- a/telethon/utils.py +++ b/telethon/utils.py @@ -1029,13 +1029,13 @@ def get_peer_id(peer, add_mark=True): return peer.user_id elif isinstance(peer, types.PeerChat): # Check in case the user mixed things up to avoid blowing up - if not (0 < peer.chat_id <= 0x7fffffff): + if not (0 < peer.chat_id <= 9999999999): peer.chat_id = resolve_id(peer.chat_id)[0] return -peer.chat_id if add_mark else peer.chat_id else: # if isinstance(peer, types.PeerChannel): # Check in case the user mixed things up to avoid blowing up - if not (0 < peer.channel_id <= 0x7fffffff): + if not (0 < peer.channel_id <= 9999999999): peer.channel_id = resolve_id(peer.channel_id)[0] if not add_mark: