mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 03:08:55 -05:00
change to_check.guild to getattr() (#3101)
* change to_check.guild to getattr() * add webhook check * changelog * Update changelog.d/3100.bugfix.rst Co-Authored-By: Michael H <michael@michaelhall.tech>
This commit is contained in:
parent
e2c8b11008
commit
078210b54c
1
changelog.d/3100.bugfix.rst
Normal file
1
changelog.d/3100.bugfix.rst
Normal file
@ -0,0 +1 @@
|
|||||||
|
fix ``is_automod_immune`` handling of guild check and support for checking webhooks
|
||||||
@ -653,7 +653,7 @@ class RedBase(commands.GroupMixin, commands.bot.BotBase, RPCMixin): # pylint: d
|
|||||||
``True`` if immune
|
``True`` if immune
|
||||||
|
|
||||||
"""
|
"""
|
||||||
guild = to_check.guild
|
guild = getattr(to_check, "guild", None)
|
||||||
if not guild:
|
if not guild:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@ -666,7 +666,8 @@ class RedBase(commands.GroupMixin, commands.bot.BotBase, RPCMixin): # pylint: d
|
|||||||
except AttributeError:
|
except AttributeError:
|
||||||
# webhook messages are a user not member,
|
# webhook messages are a user not member,
|
||||||
# cheaper than isinstance
|
# 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:
|
else:
|
||||||
ids_to_check.append(author.id)
|
ids_to_check.append(author.id)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user