fix(moderation): handle unbans, unmutes, bans seperately in resolve command

This commit is contained in:
Seaswimmer 2023-10-06 12:46:51 -04:00
parent 0d180d16c4
commit 477673b384
No known key found for this signature in database
GPG key ID: 5019678FD9CF50D8

View file

@ -469,14 +469,16 @@ class Moderation(commands.Cog):
case = self.generate_dict(result_2)
if reason is None:
reason = "No reason given."
if case['moderation_type'] in ['MUTE', 'TEMPBAN']:
if case['moderation_type'] in ['UNMUTE', 'UNBAN']:
await interaction.response.send_message(content="You cannot resolve this type of moderation!", ephemeral=True)
if case['moderation_type'] in ['MUTE', 'TEMPBAN', 'BAN']:
if case['moderation_type'] == 'MUTE':
try:
member = await interaction.guild.fetch_member(case['target_id'])
await member.timeout(None, reason=f"Case #{case_number} resolved by {interaction.user.id}")
except discord.NotFound:
pass
if case['moderation_type'] == 'TEMPBAN':
if case['moderation_type'] in ['TEMPBAN', 'BAN']:
try:
user = await interaction.client.fetch_user(case['target_id'])
await interaction.guild.unban(user, reason=f"Case #{case_number} resolved by {interaction.user.id}")