This commit is contained in:
josephbiko 2018-05-23 14:24:28 +00:00 committed by GitHub
commit 3b44ac11c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 3 deletions

View File

@ -2445,7 +2445,7 @@ class TelegramClient(TelegramBareClient):
async def catch_up(self):
state = self.session.get_update_state(0)
if not state:
if not state or not state.pts:
return
self.session.catching_up = True

View File

@ -552,8 +552,13 @@ def resolve_id(marked_id):
if marked_id >= 0:
return marked_id, PeerUser
if str(marked_id).startswith('-100'):
return int(str(marked_id)[4:]), PeerChannel
# There have been report of chat IDs being 10000xyz, which means their
# 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

View File

@ -477,6 +477,12 @@ def _write_arg_to_bytes(builder, arg, args, name=None):
# Else it may be a custom type
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:
builder.write(')')
if arg.is_vector: