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()
|
mentions = state.mentions.merge(mentions).to_dict()
|
||||||
else:
|
else:
|
||||||
mentions = mentions.to_dict()
|
mentions = mentions.to_dict()
|
||||||
|
else:
|
||||||
|
mentions = state.mentions and state.mentions.to_dict()
|
||||||
|
|
||||||
if file is not None and files is not None:
|
if file is not None and files is not None:
|
||||||
raise InvalidArgument('cannot pass both file and files parameter to send()')
|
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.
|
A status to start your presence with upon logging on to Discord.
|
||||||
activity: Optional[:class:`.BaseActivity`]
|
activity: Optional[:class:`.BaseActivity`]
|
||||||
An activity to start your presence with upon logging on to Discord.
|
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.
|
Control how the client handles mentions by default on every message sent.
|
||||||
|
|
||||||
.. versionadded:: 1.4
|
.. versionadded:: 1.4
|
||||||
|
@ -781,13 +781,15 @@ class Webhook:
|
|||||||
if username:
|
if username:
|
||||||
payload['username'] = username
|
payload['username'] = username
|
||||||
|
|
||||||
|
previous_mentions = getattr(self._state, 'mentions', None)
|
||||||
|
|
||||||
if mentions:
|
if mentions:
|
||||||
try:
|
if previous_mentions is not None:
|
||||||
mentions = self._state.mentions.merge(mentions).to_dict()
|
payload['allowed_mentions'] = previous_mentions.merge(mentions).to_dict()
|
||||||
except AttributeError:
|
else:
|
||||||
mentions = mentions.to_dict()
|
payload['allowed_mentions'] = mentions.to_dict()
|
||||||
finally:
|
elif previous_mentions is not None:
|
||||||
payload['allowed_mentions'] = mentions
|
payload['allowed_mentions'] = previous_mentions.to_dict()
|
||||||
|
|
||||||
return self._adapter.execute_webhook(wait=wait, file=file, files=files, payload=payload)
|
return self._adapter.execute_webhook(wait=wait, file=file, files=files, payload=payload)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user