aboutsummaryrefslogtreecommitdiff
path: root/discord/http.py
diff options
context:
space:
mode:
authorRapptz <[email protected]>2020-04-04 07:40:51 -0400
committerRapptz <[email protected]>2020-04-04 07:40:51 -0400
commit041785937e091b7e282403d45dd0c68da340a8d4 (patch)
tree1ea7a6bb47292e2a6978db690b98982338b4edba /discord/http.py
parentFix regression with Member.activities not clearing (diff)
downloaddiscord.py-041785937e091b7e282403d45dd0c68da340a8d4.tar.xz
discord.py-041785937e091b7e282403d45dd0c68da340a8d4.zip
Add support for configuring allowed mentions per message or bot wide.
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 4837bd2f..40ba7e33 100644
--- a/discord/http.py
+++ b/discord/http.py
@@ -310,7 +310,7 @@ class HTTPClient:
return self.request(Route('POST', '/users/@me/channels'), json=payload)
- def send_message(self, channel_id, content, *, tts=False, embed=None, nonce=None):
+ def send_message(self, channel_id, content, *, tts=False, embed=None, nonce=None, mentions=None):
r = Route('POST', '/channels/{channel_id}/messages', channel_id=channel_id)
payload = {}
@@ -326,12 +326,15 @@ class HTTPClient:
if nonce:
payload['nonce'] = nonce
+ if mentions:
+ payload['allowed_mentions'] = mentions
+
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, nonce=None):
+ def send_files(self, channel_id, *, files, content=None, tts=False, embed=None, nonce=None, mentions=None):
r = Route('POST', '/channels/{channel_id}/messages', channel_id=channel_id)
form = aiohttp.FormData()
@@ -342,6 +345,8 @@ class HTTPClient:
payload['embed'] = embed
if nonce:
payload['nonce'] = nonce
+ if mentions:
+ payload['allowed_mentions'] = mentions
form.add_field('payload_json', utils.to_json(payload))
if len(files) == 1: