diff options
| author | Rapptz <[email protected]> | 2015-11-28 23:05:02 -0500 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2015-11-28 23:06:23 -0500 |
| commit | c3e7ba367135817c482a9d376700ee2599281ef6 (patch) | |
| tree | 4789f98a92946d80ff5e53641bc428a9ce6d976e /discord/message.py | |
| parent | Add caveat note about Message.mention_everyone (diff) | |
| download | discord.py-c3e7ba367135817c482a9d376700ee2599281ef6.tar.xz discord.py-c3e7ba367135817c482a9d376700ee2599281ef6.zip | |
Message.channel's Object instance has an is_private attribute now.
This was to allow for basic checks such as message.channel.is_private
to succeed at the very least. It is a very small mitigation and not
perfect since it doesn't have every attribute that PrivateChannel
itself has. However you could retrieve the user info through the
Message.author attribute.
Diffstat (limited to 'discord/message.py')
| -rw-r--r-- | discord/message.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/discord/message.py b/discord/message.py index be0282fd..8601e3cd 100644 --- a/discord/message.py +++ b/discord/message.py @@ -62,6 +62,8 @@ class Message(object): The :class:`Channel` that the message was sent from. Could be a :class:`PrivateChannel` if it's a private message. In :issue:`very rare cases <21>` this could be a :class:`Object` instead. + + For the sake of convenience, this :class:`Object` instance has an attribute ``is_private`` set to ``True``. .. attribute:: server The :class:`Server` that the message belongs to. If not applicable (i.e. a PM) then it's None instead. @@ -157,7 +159,8 @@ class Message(object): self.server = None if self.channel is None: if channel_id is not None: - self.channel = Object(channel_id) + self.channel = Object(id=channel_id) + self.channel.is_private = True return if not self.channel.is_private: |