mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-22 09:26:37 +03:00
Less confusing error for getting marked ID of PeerChannel(0)
Fixes #1282.
This commit is contained in:
parent
d1ddfd09b6
commit
6da8d1a0ec
|
@ -903,8 +903,12 @@ def get_peer_id(peer, add_mark=True):
|
|||
|
||||
# Concat -100 through math tricks, .to_supergroup() on
|
||||
# Madeline IDs will be strictly positive -> log works.
|
||||
try:
|
||||
return -(peer.channel_id + pow(
|
||||
10, math.floor(math.log10(peer.channel_id) + 3)))
|
||||
except ValueError:
|
||||
raise TypeError('Cannot get marked ID of a channel '
|
||||
'unless its ID is strictly positive') from None
|
||||
|
||||
|
||||
def resolve_id(marked_id):
|
||||
|
|
Loading…
Reference in New Issue
Block a user