Skip to content

Commit

Permalink
Fix invalid date type in UpdateShort
Browse files Browse the repository at this point in the history
  • Loading branch information
Lonami committed Sep 12, 2023
1 parent 2cef715 commit 8e6862e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 8 additions & 3 deletions telethon/network/mtprotosender.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import asyncio
import collections
import struct
import datetime
import time

from . import authenticator
from ..extensions.messagepacker import MessagePacker
Expand Down Expand Up @@ -700,14 +702,17 @@ def _store_own_updates(self, obj, *, _update_ids=frozenset((
elif obj.CONSTRUCTOR_ID in _update_like_ids:
# Ugly "hack" (?) - otherwise bots reliably detect gaps when deleting messages.
#
# Note: the `date` being `None` is used to check for `updatesTooLong`, so `0` is
# used instead. It is still not read, because `updateShort` has no `seq`.
# Note: the `date` being `None` is used to check for `updatesTooLong`, so epoch
# 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`
# 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`.
# `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
self._updates_queue.put_nowait(upd)
except AttributeError:
Expand Down
2 changes: 1 addition & 1 deletion telethon/version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Versions should comply with PEP440.
# This line is parsed in setup.py:
__version__ = '1.30.0'
__version__ = '1.30.1'

0 comments on commit 8e6862e

Please sign in to comment.