Add NSFW-only filtering mode for content moderation
Some checks failed
NSFW-Only Filtering Tests / NSFW-Only Filtering Feature Tests (push) Has been cancelled
Some checks failed
NSFW-Only Filtering Tests / NSFW-Only Filtering Feature Tests (push) Has been cancelled
- Add nsfw_only_filtering field to GuildSettings model - Create database migration for new field (20260124_add_nsfw_only_filtering) - Update AI moderation logic to respect NSFW-only mode - Add Discord command !ai nsfwonly <true/false> for toggling mode - Implement filtering logic in image analysis for both attachments and embeds - Add comprehensive test suite for new functionality - Update documentation with usage examples and feature description - Create dedicated CI workflow for testing NSFW-only filtering feature When enabled, only sexual/nude content is filtered while allowing: - Violence and gore - Harassment and bullying - Hate speech - Self-harm content - Other content categories This mode is useful for gaming communities and mature discussion servers that have specific content policies allowing violence but prohibiting sexual material.
This commit is contained in:
39
migrations/versions/20260124_add_nsfw_only_filtering.py
Normal file
39
migrations/versions/20260124_add_nsfw_only_filtering.py
Normal file
@@ -0,0 +1,39 @@
|
||||
"""Add nsfw_only_filtering column to guild_settings table.
|
||||
|
||||
Revision ID: 20260124_add_nsfw_only_filtering
|
||||
Revises: 20260117_enable_ai_defaults
|
||||
Create Date: 2026-01-24 23:00:00.000000
|
||||
"""
|
||||
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = "20260124_add_nsfw_only_filtering"
|
||||
down_revision = "20260117_enable_ai_defaults"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
"""Add nsfw_only_filtering column to guild_settings table."""
|
||||
op.add_column(
|
||||
"guild_settings",
|
||||
sa.Column("nsfw_only_filtering", sa.Boolean, nullable=False, default=False)
|
||||
)
|
||||
|
||||
# Set default value for existing records
|
||||
op.execute(
|
||||
sa.text(
|
||||
"""
|
||||
UPDATE guild_settings
|
||||
SET nsfw_only_filtering = FALSE
|
||||
WHERE nsfw_only_filtering IS NULL
|
||||
"""
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
"""Remove nsfw_only_filtering column from guild_settings table."""
|
||||
op.drop_column("guild_settings", "nsfw_only_filtering")
|
||||
Reference in New Issue
Block a user