From 481b335f2d3adeef15d003d65966846c60c93b04 Mon Sep 17 00:00:00 2001 From: Rapptz Date: Sat, 4 Apr 2020 12:45:17 -0400 Subject: Fix various implementation bugs with allowed mentions --- discord/webhook.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'discord/webhook.py') diff --git a/discord/webhook.py b/discord/webhook.py index 058e4855..3218f2ab 100644 --- a/discord/webhook.py +++ b/discord/webhook.py @@ -781,13 +781,15 @@ class Webhook: if username: payload['username'] = username + previous_mentions = getattr(self._state, 'mentions', None) + if mentions: - try: - mentions = self._state.mentions.merge(mentions).to_dict() - except AttributeError: - mentions = mentions.to_dict() - finally: - payload['allowed_mentions'] = mentions + if previous_mentions is not None: + payload['allowed_mentions'] = previous_mentions.merge(mentions).to_dict() + else: + payload['allowed_mentions'] = mentions.to_dict() + elif previous_mentions is not None: + payload['allowed_mentions'] = previous_mentions.to_dict() return self._adapter.execute_webhook(wait=wait, file=file, files=files, payload=payload) -- cgit v1.2.3