mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-02-17 03:51:05 +03:00
Fix-up user_id for UserUpdate
This commit is contained in:
parent
0239852cc7
commit
facf3ae582
|
@ -2,6 +2,7 @@ import datetime
|
||||||
|
|
||||||
from .common import EventBuilder, EventCommon, name_inner_event
|
from .common import EventBuilder, EventCommon, name_inner_event
|
||||||
from ..tl import types
|
from ..tl import types
|
||||||
|
from ..tl.custom.sendergetter import SenderGetter
|
||||||
|
|
||||||
|
|
||||||
@name_inner_event
|
@name_inner_event
|
||||||
|
@ -28,7 +29,7 @@ class UserUpdate(EventBuilder):
|
||||||
event._entities = update._entities
|
event._entities = update._entities
|
||||||
return event
|
return event
|
||||||
|
|
||||||
class Event(EventCommon):
|
class Event(EventCommon, SenderGetter):
|
||||||
"""
|
"""
|
||||||
Represents the event of a user status update (last seen, joined).
|
Represents the event of a user status update (last seen, joined).
|
||||||
|
|
||||||
|
@ -92,7 +93,6 @@ class UserUpdate(EventBuilder):
|
||||||
``True`` if what's being uploaded (selected) is a contact.
|
``True`` if what's being uploaded (selected) is a contact.
|
||||||
"""
|
"""
|
||||||
def __init__(self, user_id, *, status=None, chat_id=None, typing=None):
|
def __init__(self, user_id, *, status=None, chat_id=None, typing=None):
|
||||||
# TODO Now we need to use the user_id!
|
|
||||||
if chat_id is None:
|
if chat_id is None:
|
||||||
super().__init__(types.PeerUser(user_id))
|
super().__init__(types.PeerUser(user_id))
|
||||||
else:
|
else:
|
||||||
|
@ -100,6 +100,10 @@ class UserUpdate(EventBuilder):
|
||||||
# We need the client to actually figure out its type.
|
# We need the client to actually figure out its type.
|
||||||
super().__init__(chat_id)
|
super().__init__(chat_id)
|
||||||
|
|
||||||
|
self._sender_id = user_id
|
||||||
|
self._input_sender = None
|
||||||
|
self._sender = None
|
||||||
|
|
||||||
self.online = None if status is None else \
|
self.online = None if status is None else \
|
||||||
isinstance(status, types.UserStatusOnline)
|
isinstance(status, types.UserStatusOnline)
|
||||||
|
|
||||||
|
@ -183,23 +187,23 @@ class UserUpdate(EventBuilder):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def user(self):
|
def user(self):
|
||||||
"""Alias for `chat` (conversation)."""
|
"""Alias for `sender`."""
|
||||||
return self.chat
|
return self.sender
|
||||||
|
|
||||||
async def get_user(self):
|
async def get_user(self):
|
||||||
"""Alias for `get_chat` (conversation)."""
|
"""Alias for `get_sender`."""
|
||||||
return await self.get_chat()
|
return await self.get_sender()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def input_user(self):
|
def input_user(self):
|
||||||
"""Alias for `input_chat`."""
|
"""Alias for `input_sender`."""
|
||||||
return self.input_chat
|
return self.input_sender
|
||||||
|
|
||||||
async def get_input_user(self):
|
async def get_input_user(self):
|
||||||
"""Alias for `get_input_chat`."""
|
"""Alias for `get_input_sender`."""
|
||||||
return await self.get_input_chat()
|
return await self.get_input_sender()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def user_id(self):
|
def user_id(self):
|
||||||
"""Alias for `chat_id`."""
|
"""Alias for `sender_id`."""
|
||||||
return self.chat_id
|
return self.sender_id
|
||||||
|
|
Loading…
Reference in New Issue
Block a user