aboutsummaryrefslogtreecommitdiff
path: root/discord/http.py
diff options
context:
space:
mode:
authorRapptz <[email protected]>2017-05-31 07:34:59 -0400
committerRapptz <[email protected]>2017-05-31 07:34:59 -0400
commit3330a19f35c8cc40e3b2b5b729a59556f1480809 (patch)
tree46b7d844257ede96abd8e1ac3dcf7d90307f6cea /discord/http.py
parentDon't assume the inviter is always there. (diff)
downloaddiscord.py-3330a19f35c8cc40e3b2b5b729a59556f1480809.tar.xz
discord.py-3330a19f35c8cc40e3b2b5b729a59556f1480809.zip
Support for sending a nonce.
Diffstat (limited to 'discord/http.py')
-rw-r--r--discord/http.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/discord/http.py b/discord/http.py
index ae816043..3f8c5241 100644
--- a/discord/http.py
+++ b/discord/http.py
@@ -294,7 +294,7 @@ class HTTPClient:
return self.request(Route('POST', '/users/@me/channels'), json=payload)
- def send_message(self, channel_id, content, *, tts=False, embed=None):
+ def send_message(self, channel_id, content, *, tts=False, embed=None, nonce=None):
r = Route('POST', '/channels/{channel_id}/messages', channel_id=channel_id)
payload = {}
@@ -307,12 +307,15 @@ class HTTPClient:
if embed:
payload['embed'] = embed
+ if nonce:
+ payload['nonce'] = nonce
+
return self.request(r, json=payload)
def send_typing(self, channel_id):
return self.request(Route('POST', '/channels/{channel_id}/typing', channel_id=channel_id))
- def send_files(self, channel_id, *, files, content=None, tts=False, embed=None):
+ def send_files(self, channel_id, *, files, content=None, tts=False, embed=None, nonce=None):
r = Route('POST', '/channels/{channel_id}/messages', channel_id=channel_id)
form = aiohttp.FormData()
@@ -321,6 +324,8 @@ class HTTPClient:
payload['content'] = content
if embed:
payload['embed'] = embed
+ if nonce:
+ payload['nonce'] = nonce
form.add_field('payload_json', utils.to_json(payload))
if len(files) == 1: