mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-25 10:53:44 +03:00
parent
a6781c8e34
commit
0d8497bf3b
|
@ -1009,14 +1009,8 @@ def get_peer_id(peer, add_mark=True):
|
|||
if not add_mark:
|
||||
return peer.channel_id
|
||||
|
||||
# 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
|
||||
# Growing backwards from -100_0000_000_000 indicates it's a channel
|
||||
return -(1000000000000 + peer.channel_id)
|
||||
|
||||
|
||||
def resolve_id(marked_id):
|
||||
|
|
Loading…
Reference in New Issue
Block a user