feat: added checks to determine if you're trying to shortmute an immune user

This commit is contained in:
Seaswimmer 2023-08-08 00:51:07 -04:00
parent 672e7c2936
commit 79fb4ce9ec
No known key found for this signature in database
GPG key ID: 5019678FD9CF50D8

View file

@ -40,12 +40,18 @@ class Shortmute(commands.Cog):
"interaction": interaction "interaction": interaction
} }
if evidence_image and evidence_link: if evidence_image and evidence_link:
await interaction.response.send_message(content="You've provided both the `evidence_image` and the `evidence_link` arguments! Please only use one or the other.") await interaction.response.send_message(content="You've provided both the `evidence_image` and the `evidence_link` arguments! Please only use one or the other.", ephemeral=True)
return return
elif evidence_link: elif evidence_link:
evidence = evidence_link evidence = evidence_link
elif evidence_image: elif evidence_image:
evidence = str(evidence_image) evidence = str(evidence_image)
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 == 1 or duration == -1: if duration == 1 or duration == -1:
readable_duration = f"{duration} minute" readable_duration = f"{duration} minute"
passed_info.update({ passed_info.update({