Астат ты не вознесешься

This commit is contained in:
2026-02-18 01:43:22 +07:00
parent 59a3a7b46a
commit 5d350d0885
15 changed files with 1489 additions and 183 deletions

View File

@@ -19,6 +19,7 @@ __all__ = (
"Setting",
"SpamStat",
"SpamLog",
"AutoComment",
)
@@ -252,3 +253,44 @@ class SpamLog(Base):
DateTime,
default=lambda: datetime.now(timezone.utc)
)
class AutoComment(Base):
"""
Настройки автокомментариев для каналов.
Attributes:
id: Уникальный ID
channel_id: ID канала (-100...)
text: Текст комментария (HTML)
button_text: Текст кнопки
button_url: URL кнопки
photo_url: URL фото для preview
is_enabled: Включены ли автокомментарии для этого канала
created_at: Дата создания
updated_at: Дата последнего обновления
updated_by: ID админа, который последним изменил
"""
__tablename__ = "auto_comments"
id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True)
channel_id: Mapped[int] = mapped_column(BigInteger, nullable=False, unique=True, index=True)
text: Mapped[str] = mapped_column(Text, nullable=False)
button_text: Mapped[str] = mapped_column(String(100), nullable=False)
button_url: Mapped[str] = mapped_column(String(500), nullable=False)
photo_url: Mapped[str] = mapped_column(String(500), nullable=False)
is_enabled: Mapped[bool] = mapped_column(Integer, default=1, nullable=False)
created_at: Mapped[datetime] = mapped_column(
DateTime,
default=lambda: datetime.now(timezone.utc),
nullable=False
)
updated_at: Mapped[datetime] = mapped_column(
DateTime,
default=lambda: datetime.now(timezone.utc),
onupdate=lambda: datetime.now(timezone.utc),
nullable=False
)
updated_by: Mapped[Optional[int]] = mapped_column(Integer, nullable=True)
def __repr__(self) -> str:
return f"<AutoComment(channel_id={self.channel_id}, enabled={self.is_enabled})>"