|
|
@ -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`. |
|
|
|