From c25e66786655bf3d2d816b5a36a3ae6470014b47 Mon Sep 17 00:00:00 2001 From: Rapptz Date: Fri, 27 Nov 2015 18:16:33 -0500 Subject: [PATCH] discord.Server is a valid destination in Client.send_message & co. --- discord/client.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/discord/client.py b/discord/client.py index b26cf6f48..73dc26fc7 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`.