mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-05-16 02:39:01 +00:00
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.
This commit is contained in:
parent
ed53f3fb3a
commit
c3e7ba3671
@ -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:
|
||||
|
Loading…
x
Reference in New Issue
Block a user