Bot become a Community Guard & Post send manager

added: dictionary support for censore
message/user management with dict triggers
This commit is contained in:
2025-08-22 21:44:14 +09:00
parent efdafb0efa
commit c16ec54891
27 changed files with 1746 additions and 184 deletions

15
app/infra/metrics.py Normal file
View File

@@ -0,0 +1,15 @@
import os
from prometheus_client import Counter, Histogram, start_http_server
# Счётчики/гистограммы для модерации и команд
MSG_PROCESSED = Counter("mod_messages_processed_total", "Incoming messages processed")
MSG_BLOCKED = Counter("mod_messages_blocked_total", "Incoming messages blocked")
MOD_LAT = Histogram("moderation_latency_seconds", "Latency of moderation checks",
buckets=(0.02, 0.05, 0.1, 0.2, 0.5, 1, 2))
def start_metrics_server(port: int):
try:
start_http_server(port)
except Exception:
# не валим бота, если порт занят/метрики не взлетели
pass