mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-04-22 16:51:59 +00:00
add support for allowed_mentions with message edit
This commit is contained in:
parent
fbb7add01a
commit
6e8d538f09
@ -800,6 +800,10 @@ class Message:
|
||||
If provided, the number of seconds to wait in the background
|
||||
before deleting the message we just edited. If the deletion fails,
|
||||
then it is silently ignored.
|
||||
allowed_mentions: Optional[:class:`~discord.AllowedMentions`]
|
||||
Controls the mentions being processed in this message.
|
||||
|
||||
.. versionadded:: 1.4
|
||||
|
||||
Raises
|
||||
-------
|
||||
@ -837,6 +841,18 @@ class Message:
|
||||
|
||||
delete_after = fields.pop('delete_after', None)
|
||||
|
||||
try:
|
||||
allowed_mentions = fields.pop('allowed_mentions')
|
||||
except KeyError:
|
||||
pass
|
||||
else:
|
||||
if allowed_mentions is not None:
|
||||
if self._state.allowed_mentions is not None:
|
||||
allowed_mentions = self._state.allowed_mentions.merge(allowed_mentions).to_dict()
|
||||
else:
|
||||
allowed_mentions = allowed_mentions.to_dict()
|
||||
fields['allowed_mentions'] = allowed_mentions
|
||||
|
||||
if fields:
|
||||
data = await self._state.http.edit_message(self.channel.id, self.id, **fields)
|
||||
self._update(data)
|
||||
|
Loading…
x
Reference in New Issue
Block a user