aboutsummaryrefslogtreecommitdiff
path: root/discord/message.py
diff options
context:
space:
mode:
authorRapptz <[email protected]>2016-01-06 23:40:20 -0500
committerRapptz <[email protected]>2016-01-06 23:40:20 -0500
commit89a418a3886d3a96cb77965eacdc1078dbb38dbf (patch)
tree780081950726e834a92b1178449ae5f3d814f578 /discord/message.py
parent[commands] Don't skip whitespace if the command trigger is found. (diff)
downloaddiscord.py-89a418a3886d3a96cb77965eacdc1078dbb38dbf.tar.xz
discord.py-89a418a3886d3a96cb77965eacdc1078dbb38dbf.zip
Add __slots__ for missing classes that didn't have it.
Diffstat (limited to 'discord/message.py')
-rw-r--r--discord/message.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/discord/message.py b/discord/message.py
index a610bd36..3db7bdb3 100644
--- a/discord/message.py
+++ b/discord/message.py
@@ -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