mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-08-07 13:34:59 +03:00
Merge bb0d29bdd5
into aba478789c
This commit is contained in:
commit
3b44ac11c4
|
@ -2445,7 +2445,7 @@ class TelegramClient(TelegramBareClient):
|
||||||
|
|
||||||
async def catch_up(self):
|
async def catch_up(self):
|
||||||
state = self.session.get_update_state(0)
|
state = self.session.get_update_state(0)
|
||||||
if not state:
|
if not state or not state.pts:
|
||||||
return
|
return
|
||||||
|
|
||||||
self.session.catching_up = True
|
self.session.catching_up = True
|
||||||
|
|
|
@ -552,8 +552,13 @@ def resolve_id(marked_id):
|
||||||
if marked_id >= 0:
|
if marked_id >= 0:
|
||||||
return marked_id, PeerUser
|
return marked_id, PeerUser
|
||||||
|
|
||||||
if str(marked_id).startswith('-100'):
|
# There have been report of chat IDs being 10000xyz, which means their
|
||||||
return int(str(marked_id)[4:]), PeerChannel
|
# marked version is -10000xyz, which in turn looks like a channel but
|
||||||
|
# it becomes 00xyz (= xyz). Hence, we must assert that there are only
|
||||||
|
# two zeroes.
|
||||||
|
m = re.match(r'-100([^0]\d*)', str(marked_id))
|
||||||
|
if m:
|
||||||
|
return int(m.group(1)), PeerChannel
|
||||||
|
|
||||||
return -marked_id, PeerChat
|
return -marked_id, PeerChat
|
||||||
|
|
||||||
|
|
|
@ -477,6 +477,12 @@ def _write_arg_to_bytes(builder, arg, args, name=None):
|
||||||
# Else it may be a custom type
|
# Else it may be a custom type
|
||||||
builder.write('bytes({})', name)
|
builder.write('bytes({})', name)
|
||||||
|
|
||||||
|
# If the type is not boxed (i.e. starts with lowercase) we should
|
||||||
|
# not serialize the constructor ID (so remove its first 4 bytes).
|
||||||
|
boxed = arg.type[arg.type.find('.') + 1].isupper()
|
||||||
|
if not boxed:
|
||||||
|
builder.write('[4:]')
|
||||||
|
|
||||||
if arg.is_flag:
|
if arg.is_flag:
|
||||||
builder.write(')')
|
builder.write(')')
|
||||||
if arg.is_vector:
|
if arg.is_vector:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user