diff options
| author | Rapptz <[email protected]> | 2015-11-27 18:16:33 -0500 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2015-11-27 18:19:38 -0500 |
| commit | c25e66786655bf3d2d816b5a36a3ae6470014b47 (patch) | |
| tree | f3d13efbf9c855ba407e33dfc3e8bb7b1085d31a | |
| parent | reply.py example now checks for self-authoring (diff) | |
| download | discord.py-c25e66786655bf3d2d816b5a36a3ae6470014b47.tar.xz discord.py-c25e66786655bf3d2d816b5a36a3ae6470014b47.zip | |
discord.Server is a valid destination in Client.send_message & co.
| -rw-r--r-- | discord/client.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/discord/client.py b/discord/client.py index b26cf6f4..73dc26fc 100644 --- a/discord/client.py +++ b/discord/client.py @@ -517,7 +517,7 @@ class Client(object): return invite def _resolve_destination(self, destination): - if isinstance(destination, Channel) or isinstance(destination, PrivateChannel): + if isinstance(destination, (Channel, PrivateChannel, Server)): return destination.id elif isinstance(destination, User): found = utils.find(lambda pm: pm.user == destination, self.private_channels) @@ -632,10 +632,12 @@ class Client(object): def send_message(self, destination, content, mentions=True, tts=False): """Sends a message to the destination given with the content given. - The destination could be a :class:`Channel` or a :class:`PrivateChannel`. For convenience - it could also be a :class:`User`. If it's a :class:`User` or :class:`PrivateChannel` then it - sends the message via private message, otherwise it sends the message to the channel. If it is - a :class:`Object` instance then it is assumed to be the destination ID. + The destination could be a :class:`Channel`, :class:`PrivateChannel` or :class:`Server`. + For convenience it could also be a :class:`User`. If it's a :class:`User` or :class:`PrivateChannel` + then it sends the message via private message, otherwise it sends the message to the channel. + If the destination is a :class:`Server` then it's equivalent to calling + :meth:`Server.get_default_channel` and sending it there. If it is a :class:`Object` + instance then it is assumed to be the destination ID. .. versionchanged:: 0.9.0 ``str`` being allowed was removed and replaced with :class:`Object`. |