add stats counter

This commit is contained in:
Rykov7
2022-11-02 17:11:12 +03:00
parent 6b648e5dbe
commit 26d08ef0b5
2 changed files with 14 additions and 2 deletions
+9 -1
View File
@@ -5,7 +5,7 @@ import time
from threading import Thread
from datetime import datetime as dt
import csv
import shelve
from .config import PYTHONCHATRU, bot
@@ -39,6 +39,14 @@ def remind(chat_to_repeat, today):
bot.send_message(chat_to_repeat, notification, parse_mode='HTML')
@repeat(every().day.at('05:00'), PYTHONCHATRU)
def stat_report(chat_to_repeat):
with shelve.open('chat_stats') as s:
bot.send_message(chat_to_repeat, f"""🚨 <b>Статистика нарушений</b>
├ <b>Удалено спамеров:</b> {s['Banned']}
└ <b>Удалено сообщений:</b> {s['Deleted']}""", parse_mode='HTML')
def print_get_jobs():
all_jobs = get_jobs()
text = f"├ <b>Jobs:</b> {str(len(all_jobs))}\