new users and gamers today
This commit is contained in:
parent
141022727d
commit
8a813be5cc
1 changed files with 17 additions and 2 deletions
|
|
@ -113,6 +113,7 @@ class AdminBot:
|
|||
"""Status command - show statistics"""
|
||||
try:
|
||||
import sqlite3
|
||||
from datetime import date
|
||||
conn = sqlite3.connect(self.db.db_path)
|
||||
cursor = conn.cursor()
|
||||
|
||||
|
|
@ -120,10 +121,24 @@ class AdminBot:
|
|||
cursor.execute("SELECT COUNT(*) FROM telegram_users")
|
||||
users_count = cursor.fetchone()[0]
|
||||
|
||||
# Count new users today
|
||||
today = date.today().isoformat()
|
||||
cursor.execute("SELECT COUNT(*) FROM telegram_users WHERE DATE(created_at) = ?", (today,))
|
||||
users_today = cursor.fetchone()[0]
|
||||
|
||||
# Count unique gamers
|
||||
cursor.execute("SELECT COUNT(DISTINCT username) FROM gamers")
|
||||
gamers_count = cursor.fetchone()[0]
|
||||
|
||||
# Count new gamers today (from user_gamers table)
|
||||
cursor.execute("""
|
||||
SELECT COUNT(DISTINCT g.id)
|
||||
FROM user_gamers ug
|
||||
JOIN gamers g ON ug.gamer_id = g.id
|
||||
WHERE DATE(ug.created_at) = ?
|
||||
""", (today,))
|
||||
gamers_today = cursor.fetchone()[0]
|
||||
|
||||
conn.close()
|
||||
|
||||
# Get message counters statistics
|
||||
|
|
@ -144,8 +159,8 @@ class AdminBot:
|
|||
|
||||
message = (
|
||||
f"📊 <b>Статистика базы данных</b>\n\n"
|
||||
f"👥 Пользователей Telegram: {users_count}\n"
|
||||
f"🎮 Отслеживаемых игроков: {gamers_count}\n\n"
|
||||
f"👥 Пользователей Telegram: {users_count} (сегодня: {users_today})\n"
|
||||
f"🎮 Отслеживаемых игроков: {gamers_count} (сегодня: {gamers_today})\n\n"
|
||||
f"📨 <b>Счетчики сообщений</b>\n\n"
|
||||
f"Всего отправлено: <b>{stats['total_all_time']}</b>\n"
|
||||
f"Сегодня отправлено: <b>{stats['total_today']}</b>\n\n"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue