diff --git a/changelog.d/3100.bugfix.rst b/changelog.d/3100.bugfix.rst new file mode 100644 index 000000000..53e3797b4 --- /dev/null +++ b/changelog.d/3100.bugfix.rst @@ -0,0 +1 @@ +fix ``is_automod_immune`` handling of guild check and support for checking webhooks diff --git a/redbot/core/bot.py b/redbot/core/bot.py index 796ed7a27..a7becdf73 100644 --- a/redbot/core/bot.py +++ b/redbot/core/bot.py @@ -653,7 +653,7 @@ class RedBase(commands.GroupMixin, commands.bot.BotBase, RPCMixin): # pylint: d ``True`` if immune """ - guild = to_check.guild + guild = getattr(to_check, "guild", None) if not guild: return False @@ -666,7 +666,8 @@ class RedBase(commands.GroupMixin, commands.bot.BotBase, RPCMixin): # pylint: d except AttributeError: # webhook messages are a user not member, # cheaper than isinstance - return True # webhooks require significant permissions to enable. + if author.bot and author.discriminator == "0000": + return True # webhooks require significant permissions to enable. else: ids_to_check.append(author.id)