Fix various implementation bugs with allowed mentions

This commit is contained in:
Rapptz
2020-04-04 12:45:17 -04:00
parent 041785937e
commit 481b335f2d
3 changed files with 11 additions and 7 deletions

View File

@ -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)