update aimod

This commit is contained in:
Slipstream 2025-06-08 20:31:51 -06:00
parent 84b6812073
commit 0fb92097d4

View File

@ -841,58 +841,6 @@ class AIModerationCog(commands.Cog):
"Moderation instructions have been reset to the default.", ephemeral=False
)
@config_subgroup.command(
name="update_instructions",
description="Update moderation instructions from the specified channel.",
)
@app_commands.describe(
channel="The channel containing the moderation instructions."
)
@app_commands.checks.has_permissions(administrator=True)
async def update_instructions(
self, interaction: discord.Interaction, channel: discord.TextChannel
) -> None:
"""Pull moderation instructions from a channel and update the global config."""
messages = []
async for msg in channel.history(
limit=MAX_RULE_MESSAGES + 1, oldest_first=True
):
if msg.content:
messages.append(msg.content)
if len(messages) > MAX_RULE_MESSAGES:
await interaction.response.send_message(
f"Channel has more than {MAX_RULE_MESSAGES} messages."
" Please consolidate your instructions into fewer messages.",
ephemeral=True,
)
return
if not messages:
await interaction.response.send_message(
"No messages found in that channel.", ephemeral=True
)
return
instructions_text = "\n\n".join(messages).strip()
aimod_config_module.MODERATION_INSTRUCTIONS = instructions_text
await interaction.response.send_message(
f"Moderation instructions updated from {channel.mention}.", ephemeral=False
)
@config_subgroup.command(
name="reset_instructions",
description="Reset moderation instructions to the default version.",
)
@app_commands.checks.has_permissions(administrator=True)
async def reset_instructions(self, interaction: discord.Interaction) -> None:
"""Reset moderation instructions to the default string."""
aimod_config_module.MODERATION_INSTRUCTIONS = (
aimod_config_module.DEFAULT_MODERATION_INSTRUCTIONS
)
await interaction.response.send_message(
"Moderation instructions have been reset to the default.", ephemeral=False
)
@infractions_subgroup.command(
name="view",
description="View a user's AI moderation infraction history (mod/admin only).",