Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ dependencies = [
"cachetools",
"defusedxml",
"dateparser",
"simplemma[marisa-trie]>=1.1.1",
"slixmpp>=1.8.0",
"sqlalchemy>=2.0.4",
]
Expand Down Expand Up @@ -87,5 +88,5 @@ max-doc-length = 72
convention = "pep257"

[tool.ruff.lint.pylint]
max-args = 8
max-args = 10
max-nested-blocks = 4
22 changes: 9 additions & 13 deletions xpartamupp/lobby_moderation_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from typing import Any, ClassVar

from sqlalchemy import (
JSON,
DateTime,
ForeignKey,
String,
Expand Down Expand Up @@ -69,20 +70,13 @@ class Base(DeclarativeBase):
}


class Blacklist(Base):
class ProfanityTerms(Base):
"""Model for profanity terms."""

__tablename__ = "profanity_blacklist"
__tablename__ = "profanity_terms"

word: Mapped[str] = mapped_column(String(255), primary_key=True)


class Whitelist(Base):
"""Model for terms which are whitelisted from profanity."""

__tablename__ = "profanity_whitelist"

word: Mapped[str] = mapped_column(String(255), primary_key=True)
term: Mapped[str] = mapped_column(String(255), primary_key=True)
language: Mapped[str] = mapped_column(String(2), primary_key=True)


class ProfanityIncident(Base):
Expand All @@ -91,10 +85,12 @@ class ProfanityIncident(Base):
__tablename__ = "profanity_incidents"

id: Mapped[int] = mapped_column(primary_key=True)
timestamp: Mapped[datetime]
timestamp: Mapped[datetime] = mapped_column(default=partial(datetime.now, tz=UTC))
player: Mapped[str] = mapped_column(String(255))
room: Mapped[str] = mapped_column(String(255))
offending_content: Mapped[str] = mapped_column(UnicodeText)
deleted: Mapped[bool]
detected_languages: Mapped[list[str]] = mapped_column(JSON)
matched_terms: Mapped[list[str]] = mapped_column(JSON)


class JIDNickWhitelist(Base):
Expand Down
Loading
Loading