add statistics
This commit is contained in:
parent
23de80f94d
commit
ceb62b408a
6 changed files with 318 additions and 3 deletions
|
|
@ -76,6 +76,26 @@ class Database:
|
|||
)
|
||||
''')
|
||||
|
||||
# Create message_counters table for tracking sent messages
|
||||
cursor.execute('''
|
||||
CREATE TABLE IF NOT EXISTS message_counters (
|
||||
command TEXT PRIMARY KEY,
|
||||
total_count INTEGER DEFAULT 0,
|
||||
today_count INTEGER DEFAULT 0,
|
||||
last_reset_date DATE DEFAULT CURRENT_DATE
|
||||
)
|
||||
''')
|
||||
|
||||
# Initialize counters for all commands
|
||||
commands = ['start', 'addgamer', 'addtoken', 'getgamers', 'delgamer',
|
||||
'today', 'yesterday', 'week', 'setperiod', 'lang', 'resetlang',
|
||||
'periodic_notification']
|
||||
for cmd in commands:
|
||||
cursor.execute('''
|
||||
INSERT OR IGNORE INTO message_counters (command, total_count, today_count, last_reset_date)
|
||||
VALUES (?, 0, 0, CURRENT_DATE)
|
||||
''', (cmd,))
|
||||
|
||||
conn.commit()
|
||||
|
||||
# Migrate tokens from gamers to user_gamers if needed
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue