diff options
| author | Rapptz <[email protected]> | 2020-04-04 12:45:17 -0400 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2020-04-04 12:45:17 -0400 |
| commit | 481b335f2d3adeef15d003d65966846c60c93b04 (patch) | |
| tree | 12f1a78a50d83f400a4f269ac062334f76fbf28a /discord/webhook.py | |
| parent | Add support for configuring allowed mentions per message or bot wide. (diff) | |
| download | discord.py-481b335f2d3adeef15d003d65966846c60c93b04.tar.xz discord.py-481b335f2d3adeef15d003d65966846c60c93b04.zip | |
Fix various implementation bugs with allowed mentions
Diffstat (limited to 'discord/webhook.py')
| -rw-r--r-- | discord/webhook.py | 14 |
1 files changed, 8 insertions, 6 deletions
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) |