aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRapptz <[email protected]>2015-09-20 02:59:59 -0400
committerRapptz <[email protected]>2015-09-20 02:59:59 -0400
commit81a9330f46af4f9bd2ab5e13a371358031507225 (patch)
tree955095d3e252288b02c615ab6ddbcee0b180e078
parentaccept_invite now works on some invite URLs. (diff)
downloaddiscord.py-81a9330f46af4f9bd2ab5e13a371358031507225.tar.xz
discord.py-81a9330f46af4f9bd2ab5e13a371358031507225.zip
Add TTS support for messages.
-rw-r--r--discord/client.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/discord/client.py b/discord/client.py
index 71a2a618..233ca435 100644
--- a/discord/client.py
+++ b/discord/client.py
@@ -390,7 +390,7 @@ class Client(object):
else:
log.error(request_logging_format.format(name='start_private_message', response=r))
- def send_message(self, destination, content, mentions=True):
+ 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
@@ -406,6 +406,7 @@ class Client(object):
:param destination: The location to send the message.
:param content: The content of the message to send.
:param mentions: A list of :class:`User` to mention in the message or a boolean. Ignored for private messages.
+ :param tts: If ``True``, sends tries to send the message using text-to-speech.
:return: The :class:`Message` sent or None if error occurred.
"""
@@ -436,6 +437,9 @@ class Client(object):
if not is_private_message:
payload['mentions'] = mentions
+ if tts:
+ payload['tts'] = True
+
response = requests.post(url, json=payload, headers=self.headers)
if response.status_code == 200:
data = response.json()