From 9d9d96fce11db81f23b33ca5a26b31034307957e Mon Sep 17 00:00:00 2001 From: Rapptz Date: Sat, 23 Jul 2022 15:14:45 -0400 Subject: [PATCH] Fix crash with automod due to silent Discord breaking change Fix #8264 --- discord/automod.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/discord/automod.py b/discord/automod.py index 28c508aa0..41f5f19da 100644 --- a/discord/automod.py +++ b/discord/automod.py @@ -419,7 +419,7 @@ class AutoModAction: The matched keyword from the triggering message. matched_content: Optional[:class:`str`] The matched content from the triggering message. - Requires the :attr:`Intents.message_content` or it will always return an empty string. + Requires the :attr:`Intents.message_content` or it will always return ``None``. """ __slots__ = ( @@ -447,9 +447,9 @@ class AutoModAction: self.channel_id: Optional[int] = utils._get_as_snowflake(data, 'channel_id') self.user_id: int = int(data['user_id']) self.alert_system_message_id: Optional[int] = utils._get_as_snowflake(data, 'alert_system_message_id') - self.content: str = data['content'] + self.content: str = data.get('content', '') self.matched_keyword: Optional[str] = data['matched_keyword'] - self.matched_content: Optional[str] = data['matched_content'] + self.matched_content: Optional[str] = data.get('matched_content') def __repr__(self) -> str: return f''