Fix various implementation bugs with allowed mentions
This commit is contained in:
parent
041785937e
commit
481b335f2d
@ -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()')
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user