Move attributes out of Thread and into User/Page/Group

This commit is contained in:
Mads Marquart
2020-01-08 12:00:45 +01:00
parent a36ff5ee6e
commit 45c0a4772d
4 changed files with 30 additions and 10 deletions

View File

@@ -10,6 +10,16 @@ class Group(Thread):
type = ThreadType.GROUP
#: The group's picture
photo = attr.ib(None)
#: The name of the group
name = attr.ib(None)
#: Datetime when the group was last active / when the last message was sent
last_active = attr.ib(None)
#: Number of messages in the group
message_count = attr.ib(None)
#: Set `Plan`
plan = attr.ib(None)
#: Unique list (set) of the group thread's participant user IDs
participants = attr.ib(factory=set)
#: A dictionary, containing user nicknames mapped to their IDs

View File

@@ -10,6 +10,16 @@ class Page(Thread):
type = ThreadType.PAGE
#: The page's picture
photo = attr.ib(None)
#: The name of the page
name = attr.ib(None)
#: Datetime when the thread was last active / when the last message was sent
last_active = attr.ib(None)
#: Number of messages in the thread
message_count = attr.ib(None)
#: Set `Plan`
plan = attr.ib(None)
#: The page's custom URL
url = attr.ib(None)
#: The name of the page's location city

View File

@@ -75,16 +75,6 @@ class Thread:
uid = attr.ib(converter=str)
#: Specifies the type of thread. Can be used a ``thread_type``. See :ref:`intro_threads` for more info
type = None
#: The thread's picture
photo = attr.ib(None)
#: The name of the thread
name = attr.ib(None)
#: Datetime when the thread was last active / when the last message was sent
last_active = attr.ib(None)
#: Number of messages in the thread
message_count = attr.ib(None)
#: Set `Plan`
plan = attr.ib(None)
@staticmethod
def _parse_customization_info(data):

View File

@@ -47,6 +47,16 @@ class User(Thread):
type = ThreadType.USER
#: The user's picture
photo = attr.ib(None)
#: The name of the user
name = attr.ib(None)
#: Datetime when the thread was last active / when the last message was sent
last_active = attr.ib(None)
#: Number of messages in the thread
message_count = attr.ib(None)
#: Set `Plan`
plan = attr.ib(None)
#: The profile URL
url = attr.ib(None)
#: The users first name