diff options
| -rw-r--r-- | discord/abc.py | 2 | ||||
| -rw-r--r-- | discord/client.py | 2 | ||||
| -rw-r--r-- | discord/webhook.py | 14 |
3 files changed, 11 insertions, 7 deletions
diff --git a/discord/abc.py b/discord/abc.py index b4a07791..7ce7224f 100644 --- a/discord/abc.py +++ b/discord/abc.py @@ -838,6 +838,8 @@ class Messageable(metaclass=abc.ABCMeta): mentions = state.mentions.merge(mentions).to_dict() else: mentions = mentions.to_dict() + else: + mentions = state.mentions and state.mentions.to_dict() if file is not None and files is not None: raise InvalidArgument('cannot pass both file and files parameter to send()') diff --git a/discord/client.py b/discord/client.py index bbc323d6..9a673f79 100644 --- a/discord/client.py +++ b/discord/client.py @@ -149,7 +149,7 @@ class Client: A status to start your presence with upon logging on to Discord. activity: Optional[:class:`.BaseActivity`] An activity to start your presence with upon logging on to Discord. - mention: Optional[:class:`AllowedMentions`] + mentions: Optional[:class:`AllowedMentions`] Control how the client handles mentions by default on every message sent. .. versionadded:: 1.4 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) |