diff options
| author | StarrFox <[email protected]> | 2020-05-07 09:06:25 -0500 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2020-05-10 16:48:31 -0400 |
| commit | 6e8d538f0975d1c5d189f0ed11a043bafebb05e7 (patch) | |
| tree | 872cf371188d5d87226e2c8db112d62c2a5d5c73 | |
| parent | Specify the unit for `max_age` arg in `GuildChannel.create_invite()` (diff) | |
| download | discord.py-6e8d538f0975d1c5d189f0ed11a043bafebb05e7.tar.xz discord.py-6e8d538f0975d1c5d189f0ed11a043bafebb05e7.zip | |
add support for allowed_mentions with message edit
| -rw-r--r-- | discord/message.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/discord/message.py b/discord/message.py index acf9e056..51c7005c 100644 --- a/discord/message.py +++ b/discord/message.py @@ -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) |