From 4ca9760284be2d5e62e9c36e1e6c844677de35a1 Mon Sep 17 00:00:00 2001 From: SeaswimmerTheFsh Date: Fri, 2 Feb 2024 11:36:46 -0500 Subject: [PATCH] fix(aurora): cleaned up addrole --- aurora/aurora.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/aurora/aurora.py b/aurora/aurora.py index 332a11e..66779d9 100644 --- a/aurora/aurora.py +++ b/aurora/aurora.py @@ -58,7 +58,7 @@ class Aurora(commands.Cog): This cog stores all of its data in an SQLite database.""" __author__ = "SeaswimmerTheFsh" - __version__ = "2.0.4" + __version__ = "2.0.5" async def red_delete_data_for_user(self, *, requester, user_id: int): if requester == "discord_deleted_user": @@ -347,7 +347,7 @@ class Aurora(commands.Cog): matching_role = None for role_id in addrole_whitelist: - if role_id == role: + if role_id == role.id: matching_role = role_id break @@ -362,15 +362,13 @@ class Aurora(commands.Cog): ): return - if role in [role.id for role in target.roles]: + if role in [user_role.id for user_role in target.roles]: await interaction.response.send_message( content=error(f"{target.mention} already has this role!"), ephemeral=True, ) return - role_obj = interaction.guild.get_role(role) - if silent is None: silent = not await config.guild(interaction.guild).dm_users() if silent is False: @@ -380,7 +378,7 @@ class Aurora(commands.Cog): guild=interaction.guild, moderator=interaction.user, reason=reason, - moderation_type=f"`{role_obj.name}` role", + moderation_type=f"`{role.name}` role", response=await interaction.original_response(), duration=parsed_time, ) @@ -393,7 +391,7 @@ class Aurora(commands.Cog): reason=f"Role added by {interaction.user.id}{(' for ' + {humanize.precisedelta(parsed_time)} if parsed_time != 'NULL' else '')} for: {reason}", ) await interaction.response.send_message( - content=f"{target.mention} has been given the {role_obj.name} role{(' for ' + {humanize.precisedelta(parsed_time)} if parsed_time != 'NULL' else '')}!\n**Reason** - `{reason}`" + content=f"{target.mention} has been given the {role.mention} role{(' for ' + {humanize.precisedelta(parsed_time)} if parsed_time != 'NULL' else '')}!\n**Reason** - `{reason}`" ) moderation_id = await mysql_log( @@ -407,7 +405,7 @@ class Aurora(commands.Cog): reason, ) await interaction.edit_original_response( - content=f"{target.mention} has been given the {role_obj.name} role{(' for ' + {humanize.precisedelta(parsed_time)} if parsed_time != 'NULL' else '')}! (Case `#{moderation_id:,}`)\n**Reason** - `{reason}`" + content=f"{target.mention} has been given the {role.mention} role{(' for ' + {humanize.precisedelta(parsed_time)} if parsed_time != 'NULL' else '')}! (Case `#{moderation_id:,}`)\n**Reason** - `{reason}`" ) await log(interaction, moderation_id)