aboutsummaryrefslogtreecommitdiff
path: root/discord/webhook.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/webhook.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/webhook.py')
-rw-r--r--discord/webhook.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/discord/webhook.py b/discord/webhook.py
index 2fcfd080..058e4855 100644
--- a/discord/webhook.py
+++ b/discord/webhook.py
@@ -688,7 +688,7 @@ class Webhook:
return self._adapter.edit_webhook(**payload)
def send(self, content=None, *, wait=False, username=None, avatar_url=None, tts=False,
- file=None, files=None, embed=None, embeds=None):
+ file=None, files=None, embed=None, embeds=None, mentions=None):
"""|maybecoro|
Sends a message using the webhook.
@@ -732,6 +732,10 @@ class Webhook:
embeds: List[:class:`Embed`]
A list of embeds to send with the content. Maximum of 10. This cannot
be mixed with the ``embed`` parameter.
+ mentions: :class:`AllowedMentions`
+ Controls the mentions being processed in this message.
+
+ .. versionadded:: 1.4
Raises
--------
@@ -777,6 +781,14 @@ class Webhook:
if username:
payload['username'] = username
+ if mentions:
+ try:
+ mentions = self._state.mentions.merge(mentions).to_dict()
+ except AttributeError:
+ mentions = mentions.to_dict()
+ finally:
+ payload['allowed_mentions'] = mentions
+
return self._adapter.execute_webhook(wait=wait, file=file, files=files, payload=payload)
def execute(self, *args, **kwargs):