Add input user versions to events.ChatAction

This commit is contained in:
Lonami Exo 2018-03-03 23:31:06 +01:00
parent c40a3ca77c
commit 1c8bf44713

View File

@ -607,6 +607,7 @@ class ChatAction(_EventBuilder):
self.created = bool(created)
self._user_peers = users if isinstance(users, list) else [users]
self._users = None
self._input_users = None
self.new_title = new_title
@property
@ -665,6 +666,16 @@ class ChatAction(_EventBuilder):
except (StopIteration, TypeError):
return None
@property
def input_user(self):
"""
Input version of the self.user property.
"""
try:
return next(self.input_users)
except (StopIteration, TypeError):
return None
@property
def users(self):
"""
@ -681,6 +692,22 @@ class ChatAction(_EventBuilder):
return self._users
@property
def input_users(self):
"""
Input version of the self.users property.
"""
if self._input_users is None and self._user_peers:
self._input_users = []
for peer in self._user_peers:
try:
self._input_users.append(self._client.get_input_entity(
peer
))
except (TypeError, ValueError):
pass
return self._input_users
class UserUpdate(_EventBuilder):
"""