Client.send_message can now accept a string ID as the destination.
This commit is contained in:
parent
2559051e06
commit
8b03918c3d
@ -498,7 +498,8 @@ class Client(object):
|
||||
|
||||
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.
|
||||
sends the message via private message, otherwise it sends the message to the channel. If it's
|
||||
a ``str`` instance, then it assumes it's a channel ID and uses that for its destination.
|
||||
|
||||
The content must be a type that can convert to a string through ``str(content)``.
|
||||
|
||||
@ -526,8 +527,10 @@ class Client(object):
|
||||
channel_id = self.private_channels[-1].id
|
||||
else:
|
||||
channel_id = found.id
|
||||
elif isinstance(destination, str):
|
||||
channel_id = destination
|
||||
else:
|
||||
raise InvalidDestination('Destination must be Channel, PrivateChannel, or User')
|
||||
raise InvalidDestination('Destination must be Channel, PrivateChannel, User, or str')
|
||||
|
||||
content = str(content)
|
||||
mentions = self._resolve_mentions(content, mentions)
|
||||
|
Loading…
x
Reference in New Issue
Block a user