Add __slots__ for missing classes that didn't have it.
This commit is contained in:
@ -87,6 +87,11 @@ class Message:
|
||||
A list of attachments given to a message.
|
||||
"""
|
||||
|
||||
__slots__ = [ 'edited_timestamp', 'timestamp', 'tts', 'content', 'channel',
|
||||
'mention_everyone', 'embeds', 'id', 'mentions', 'author',
|
||||
'channel_mentions', 'server', '_raw_mentions', 'attachments',
|
||||
'_clean_content', '_raw_channel_mentions' ]
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
# at the moment, the timestamps seem to be naive so they have no time zone and operate on UTC time.
|
||||
# we can use this to our advantage to use strptime instead of a complicated parsing routine.
|
||||
@ -124,7 +129,7 @@ class Message:
|
||||
if channel is not None:
|
||||
self.channel_mentions.append(channel)
|
||||
|
||||
@utils.cached_property
|
||||
@utils.cached_slot_property('_raw_mentions')
|
||||
def raw_mentions(self):
|
||||
"""A property that returns an array of user IDs matched with
|
||||
the syntax of <@user_id> in the message content.
|
||||
@ -134,7 +139,7 @@ class Message:
|
||||
"""
|
||||
return re.findall(r'<@([0-9]+)>', self.content)
|
||||
|
||||
@utils.cached_property
|
||||
@utils.cached_slot_property('_raw_channel_mentions')
|
||||
def raw_channel_mentions(self):
|
||||
"""A property that returns an array of channel IDs matched with
|
||||
the syntax of <#channel_id> in the message content.
|
||||
@ -144,7 +149,7 @@ class Message:
|
||||
"""
|
||||
return re.findall(r'<#([0-9]+)>', self.content)
|
||||
|
||||
@utils.cached_property
|
||||
@utils.cached_slot_property('_clean_content')
|
||||
def clean_content(self):
|
||||
"""A property that returns the content in a "cleaned up"
|
||||
manner. This basically means that mentions are transformed
|
||||
|
Reference in New Issue
Block a user