diff --git a/cogs/aimod_cog.py b/cogs/aimod_cog.py index 75c73f6..5a129e2 100644 --- a/cogs/aimod_cog.py +++ b/cogs/aimod_cog.py @@ -853,6 +853,59 @@ class AIModerationCog(commands.Cog): await interaction.response.send_message(embed=embed, ephemeral=False) + @appeal_subgroup.command( + name="human_review", + description="Request a human moderator to review your case.", + ) + @app_commands.describe( + reason="Explain why you want a human to review the AI decision", + guild_id="If using in DMs, provide the server ID", + ) + async def appeal_human_review( + self, + interaction: discord.Interaction, + reason: str, + guild_id: int | None = None, + ): + """Let a user request a manual moderator review.""" + guild = interaction.guild or ( + self.bot.get_guild(guild_id) if guild_id else None + ) + if not guild: + await interaction.response.send_message( + "Invalid or missing guild ID.", ephemeral=True + ) + return + + log_channel_id = get_guild_config(guild.id, "MOD_LOG_CHANNEL_ID") + log_channel = self.bot.get_channel(log_channel_id) if log_channel_id else None + if not log_channel: + await interaction.response.send_message( + "Appeals are not enabled for this server.", ephemeral=True + ) + return + + timestamp = datetime.datetime.utcnow().isoformat() + await add_user_appeal( + guild.id, interaction.user.id, "HUMAN_REVIEW", reason, timestamp, "" + ) + + embed = discord.Embed( + title="Human Review Requested", color=discord.Color.orange() + ) + embed.add_field( + name="User", + value=f"{interaction.user} ({interaction.user.id})", + inline=False, + ) + embed.add_field(name="Request", value=reason, inline=False) + embed.timestamp = discord.utils.utcnow() + await log_channel.send(embed=embed) + + await interaction.response.send_message( + "Your request for a human review has been sent.", ephemeral=True + ) + @infractions_subgroup.command( name="clear", description="Clear a user's AI moderation infraction history (admin only).",