diff options
| author | 2021-10-03 14:51:01 +0100 | |
|---|---|---|
| committer | 2021-10-03 14:51:01 +0100 | |
| commit | 2f0b4215f0be46c62ea529f20ccba0ea967dcd21 (patch) | |
| tree | 8e2aaa40278bfa5e4aabe02e2e26bfea09563850 | |
| parent | Merge pull request #1837 from python-discord/add-get-or-fetch-util (diff) | |
Handle channel category being None in antispam/malware checks
The code already handled the attribute not existing (e.g from a DM channel), but didn't handle TextChannels not in a category
Diffstat (limited to '')
| -rw-r--r-- | bot/exts/filters/antimalware.py | 2 | ||||
| -rw-r--r-- | bot/exts/filters/antispam.py | 2 | 
2 files changed, 2 insertions, 2 deletions
| diff --git a/bot/exts/filters/antimalware.py b/bot/exts/filters/antimalware.py index 0eedeb0fb..e708e5149 100644 --- a/bot/exts/filters/antimalware.py +++ b/bot/exts/filters/antimalware.py @@ -63,7 +63,7 @@ class AntiMalware(Cog):              return          # Ignore code jam channels -        if hasattr(message.channel, "category") and message.channel.category.name == JAM_CATEGORY_NAME: +        if getattr(message.channel, "category", None) and message.channel.category.name == JAM_CATEGORY_NAME:              return          # Check if user is staff, if is, return diff --git a/bot/exts/filters/antispam.py b/bot/exts/filters/antispam.py index fe79a5d62..70c1168bf 100644 --- a/bot/exts/filters/antispam.py +++ b/bot/exts/filters/antispam.py @@ -166,7 +166,7 @@ class AntiSpam(Cog):              not message.guild              or message.guild.id != GuildConfig.id              or message.author.bot -            or (hasattr(message.channel, "category") and message.channel.category.name == JAM_CATEGORY_NAME) +            or (getattr(message.channel, "category", None) and message.channel.category.name == JAM_CATEGORY_NAME)              or (message.channel.id in Filter.channel_whitelist and not DEBUG_MODE)              or (any(role.id in Filter.role_whitelist for role in message.author.roles) and not DEBUG_MODE)          ): | 
