forked from cswimr/SeaCogs
fix(aurora): cleaned up addrole
This commit is contained in:
parent
c9c2e1f955
commit
4ca9760284
1 changed files with 6 additions and 8 deletions
|
@ -58,7 +58,7 @@ class Aurora(commands.Cog):
|
||||||
This cog stores all of its data in an SQLite database."""
|
This cog stores all of its data in an SQLite database."""
|
||||||
|
|
||||||
__author__ = "SeaswimmerTheFsh"
|
__author__ = "SeaswimmerTheFsh"
|
||||||
__version__ = "2.0.4"
|
__version__ = "2.0.5"
|
||||||
|
|
||||||
async def red_delete_data_for_user(self, *, requester, user_id: int):
|
async def red_delete_data_for_user(self, *, requester, user_id: int):
|
||||||
if requester == "discord_deleted_user":
|
if requester == "discord_deleted_user":
|
||||||
|
@ -347,7 +347,7 @@ class Aurora(commands.Cog):
|
||||||
matching_role = None
|
matching_role = None
|
||||||
|
|
||||||
for role_id in addrole_whitelist:
|
for role_id in addrole_whitelist:
|
||||||
if role_id == role:
|
if role_id == role.id:
|
||||||
matching_role = role_id
|
matching_role = role_id
|
||||||
break
|
break
|
||||||
|
|
||||||
|
@ -362,15 +362,13 @@ class Aurora(commands.Cog):
|
||||||
):
|
):
|
||||||
return
|
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(
|
await interaction.response.send_message(
|
||||||
content=error(f"{target.mention} already has this role!"),
|
content=error(f"{target.mention} already has this role!"),
|
||||||
ephemeral=True,
|
ephemeral=True,
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
role_obj = interaction.guild.get_role(role)
|
|
||||||
|
|
||||||
if silent is None:
|
if silent is None:
|
||||||
silent = not await config.guild(interaction.guild).dm_users()
|
silent = not await config.guild(interaction.guild).dm_users()
|
||||||
if silent is False:
|
if silent is False:
|
||||||
|
@ -380,7 +378,7 @@ class Aurora(commands.Cog):
|
||||||
guild=interaction.guild,
|
guild=interaction.guild,
|
||||||
moderator=interaction.user,
|
moderator=interaction.user,
|
||||||
reason=reason,
|
reason=reason,
|
||||||
moderation_type=f"`{role_obj.name}` role",
|
moderation_type=f"`{role.name}` role",
|
||||||
response=await interaction.original_response(),
|
response=await interaction.original_response(),
|
||||||
duration=parsed_time,
|
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}",
|
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(
|
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(
|
moderation_id = await mysql_log(
|
||||||
|
@ -407,7 +405,7 @@ class Aurora(commands.Cog):
|
||||||
reason,
|
reason,
|
||||||
)
|
)
|
||||||
await interaction.edit_original_response(
|
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)
|
await log(interaction, moderation_id)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue