Fix invalid date type in UpdateShort

This commit is contained in:
Lonami Exo 2023-09-12 17:09:27 +02:00
parent 5ba312555a
commit 7ce0b2f940
2 changed files with 9 additions and 4 deletions

View File

@ -1,6 +1,8 @@
import asyncio import asyncio
import collections import collections
import struct import struct
import datetime
import time
from . import authenticator from . import authenticator
from ..extensions.messagepacker import MessagePacker from ..extensions.messagepacker import MessagePacker
@ -700,14 +702,17 @@ class MTProtoSender:
elif obj.CONSTRUCTOR_ID in _update_like_ids: elif obj.CONSTRUCTOR_ID in _update_like_ids:
# Ugly "hack" (?) - otherwise bots reliably detect gaps when deleting messages. # Ugly "hack" (?) - otherwise bots reliably detect gaps when deleting messages.
# #
# Note: the `date` being `None` is used to check for `updatesTooLong`, so `0` is # Note: the `date` being `None` is used to check for `updatesTooLong`, so epoch
# used instead. It is still not read, because `updateShort` has no `seq`. # is used instead. It is still not read, because `updateShort` has no `seq`.
# #
# Some requests, such as `readHistory`, also return these types. But the `pts_count` # Some requests, such as `readHistory`, also return these types. But the `pts_count`
# seems to be zero, so while this will produce some bogus `updateDeleteMessages`, # seems to be zero, so while this will produce some bogus `updateDeleteMessages`,
# it's still one of the "cleaner" approaches to handling the new `pts`. # it's still one of the "cleaner" approaches to handling the new `pts`.
# `updateDeleteMessages` is probably the "least-invasive" update that can be used. # `updateDeleteMessages` is probably the "least-invasive" update that can be used.
upd = _tl.UpdateShort(_tl.UpdateDeleteMessages([], obj.pts, obj.pts_count), 0) upd = _tl.UpdateShort(
_tl.UpdateDeleteMessages([], obj.pts, obj.pts_count),
datetime.datetime(*time.gmtime(0)[:6]).replace(tzinfo=datetime.timezone.utc)
)
upd._self_outgoing = True upd._self_outgoing = True
self._updates_queue.put_nowait(upd) self._updates_queue.put_nowait(upd)
except AttributeError: except AttributeError:

View File

@ -1,3 +1,3 @@
# Versions should comply with PEP440. # Versions should comply with PEP440.
# This line is parsed in setup.py: # This line is parsed in setup.py:
__version__ = '1.30.0' __version__ = '1.30.2'