Add appeal AI test command

This commit is contained in:
Codex 2025-06-07 04:02:23 +00:00 committed by Slipstream
parent d845418443
commit d7d7183a84
Signed by: slipstream
GPG Key ID: 13E498CE010AC6FD

View File

@ -2652,6 +2652,49 @@ CRITICAL: Do NOT output anything other than the required JSON response.
)
print(f"Error in aidebug_last_decisions command: {error}")
@debug_subgroup.command(
name="appeal_tests",
description="Run sample appeals through the AI reviewer (admin only).",
)
@app_commands.checks.has_permissions(administrator=True)
async def aidebug_appeal_tests(self, interaction: discord.Interaction):
"""Run a few hardcoded appeals through the appeal AI for testing."""
scenarios = [
(
"WARN",
"I was warned for spamming but I only sent a few messages quickly.",
),
(
"MUTE",
"I was muted for hate speech but it was just a meme quote, not harassment.",
),
(
"BAN",
"I was banned for posting NSFW art in the NSFW channel. It wasn't porn.",
),
]
results = []
guild = interaction.guild
for action, text in scenarios:
review = await self.run_appeal_ai(guild, interaction.user, action, text)
results.append((action, text, review))
embed = discord.Embed(
title="Appeal AI Test Results", color=discord.Color.green()
)
embed.timestamp = discord.utils.utcnow()
for idx, (action, text, review) in enumerate(results, 1):
value = (
f"**Action:** {action}\n**Appeal:** {text}\n**AI Verdict:** {review}"
)
if len(value) > 1024:
value = value[:1020] + "..."
embed.add_field(name=f"Scenario {idx}", value=value, inline=False)
await interaction.response.send_message(embed=embed, ephemeral=True)
# Setup function required by discord.py to load the cog
async def setup(bot: commands.Bot):