From 2d7eeedfe674bd1393773795fdf615285f59fbe4 Mon Sep 17 00:00:00 2001 From: SeaswimmerTheFsh Date: Wed, 27 Sep 2023 13:28:39 -0400 Subject: [PATCH] feat(shortmute): added the ability for people with administrator to shortmute people in the immune roles list --- shortmute/shortmute.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/shortmute/shortmute.py b/shortmute/shortmute.py index f405ea3..6080c91 100644 --- a/shortmute/shortmute.py +++ b/shortmute/shortmute.py @@ -64,12 +64,13 @@ class Shortmute(commands.Cog): if user_id == interaction.user.id: await interaction.response.send_message(content="You are blacklisted from `/shortmute`!", ephemeral=True) return - immune_roles_list = await self.config.guild(interaction.guild).immune_roles() - for role_id in immune_roles_list: - role = interaction.guild.get_role(role_id) - if role in target.roles: - await interaction.response.send_message(content="You're trying to shortmute someone who is immune from shortmuting.", ephemeral=True) - return + if interaction.user.guild_permissions.administrator is False: + immune_roles_list = await self.config.guild(interaction.guild).immune_roles() + for role_id in immune_roles_list: + role = interaction.guild.get_role(role_id) + if role in target.roles: + 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): readable_duration = f"{duration} minute" else: