Add human review request command

This commit is contained in:
Codex 2025-06-07 03:48:11 +00:00 committed by Slipstream
parent c3ecf7e2c0
commit 1e774b377a
Signed by: slipstream
GPG Key ID: 13E498CE010AC6FD

View File

@ -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).",