feat(shortmute): added the ability for people with administrator to shortmute people in the immune roles list
All checks were successful
Pylint / Pylint (push) Successful in 1m16s

This commit is contained in:
Seaswimmer 2023-09-27 13:28:39 -04:00
parent 4d9011c7a5
commit 2d7eeedfe6
No known key found for this signature in database
GPG key ID: 5019678FD9CF50D8

View file

@ -64,12 +64,13 @@ class Shortmute(commands.Cog):
if user_id == interaction.user.id: if user_id == interaction.user.id:
await interaction.response.send_message(content="You are blacklisted from `/shortmute`!", ephemeral=True) await interaction.response.send_message(content="You are blacklisted from `/shortmute`!", ephemeral=True)
return return
immune_roles_list = await self.config.guild(interaction.guild).immune_roles() if interaction.user.guild_permissions.administrator is False:
for role_id in immune_roles_list: immune_roles_list = await self.config.guild(interaction.guild).immune_roles()
role = interaction.guild.get_role(role_id) for role_id in immune_roles_list:
if role in target.roles: role = interaction.guild.get_role(role_id)
await interaction.response.send_message(content="You're trying to shortmute someone who is immune from shortmuting.", ephemeral=True) if role in target.roles:
return await interaction.response.send_message(content="You're trying to shortmute someone who is immune from shortmuting.", ephemeral=True)
return
if duration in (1, -1): if duration in (1, -1):
readable_duration = f"{duration} minute" readable_duration = f"{duration} minute"
else: else: