mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-01-27 01:34:29 +03:00
Fix UserUpdate not working for typing updates
The code to deal with the right chat action was there, but the updates that could trigger that code path were never checked.
This commit is contained in:
parent
e71638abf1
commit
9db9db1ade
|
@ -14,6 +14,14 @@ class UserUpdate(EventBuilder):
|
|||
if isinstance(update, types.UpdateUserStatus):
|
||||
event = cls.Event(update.user_id,
|
||||
status=update.status)
|
||||
elif isinstance(update, types.UpdateChatUserTyping):
|
||||
# Unfortunately, we can't know whether `chat_id`'s type
|
||||
event = cls.Event(update.user_id,
|
||||
chat_id=update.chat_id,
|
||||
typing=update.action)
|
||||
elif isinstance(update, types.UpdateUserTyping):
|
||||
event = cls.Event(update.user_id,
|
||||
typing=update.action)
|
||||
else:
|
||||
return
|
||||
|
||||
|
@ -83,9 +91,13 @@ class UserUpdate(EventBuilder):
|
|||
contact (`bool`):
|
||||
``True`` if what's being uploaded (selected) is a contact.
|
||||
"""
|
||||
def __init__(self, user_id, *, status=None, typing=None):
|
||||
def __init__(self, user_id, *, status=None, chat_id=None, typing=None):
|
||||
super().__init__(types.PeerUser(user_id))
|
||||
|
||||
# TODO This should be passed to init, not here
|
||||
# But we need to know the type beforehand
|
||||
self.chat_id = chat_id
|
||||
|
||||
self.online = None if status is None else \
|
||||
isinstance(status, types.UserStatusOnline)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user