diff options
author | 2021-10-05 22:36:47 +0100 | |
---|---|---|
committer | 2021-10-05 22:36:47 +0100 | |
commit | a9b02a5a85e0f558a0d9f0a2d0f0639045a421e5 (patch) | |
tree | 25aea1d67eb70dd507e64d88272573ecf09c9b6f | |
parent | Fix tests (diff) |
Use `isinstance` instead of `hasattr` to determine if `Member`
-rw-r--r-- | bot/exts/moderation/infraction/infractions.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/bot/exts/moderation/infraction/infractions.py b/bot/exts/moderation/infraction/infractions.py index 93a6b6c8b..fd47ff1c7 100644 --- a/bot/exts/moderation/infraction/infractions.py +++ b/bot/exts/moderation/infraction/infractions.py @@ -344,7 +344,7 @@ class Infractions(InfractionScheduler, commands.Cog): Will also remove the banned user from the Big Brother watch list if applicable. """ - if hasattr(user, 'top_role') and user.top_role >= ctx.me.top_role: + if isinstance(user, Member) and user.top_role >= ctx.me.top_role: await ctx.send(":x: I can't ban users above or equal to me in the role hierarchy.") return @@ -527,7 +527,7 @@ class Infractions(InfractionScheduler, commands.Cog): async def cog_command_error(self, ctx: Context, error: Exception) -> None: """Send a notification to the invoking context on a Union failure.""" if isinstance(error, commands.BadUnionArgument): - if discord.User in error.converters or discord.Member in error.converters: + if discord.User in error.converters or Member in error.converters: await ctx.send(str(error.errors[0])) error.handled = True |