mirror of
https://github.com/tiennm99/tiennm99bot.git
synced 2026-10-20 00:15:50 +00:00
feat(stats): add command usage statistics module with persistence
Implement a new stats module for the Telegram bot that tracks per-command usage with persistent KV storage. The module provides a /stats command displaying usage sorted by popularity with a 4096-byte Telegram message cap. Includes CommandHook integration for post-dispatch tracking via background goroutine (2s bounded context), proper test coverage, and registry initialization. Updated server config with stats factory and reserved concurrent execution control to prevent TOCTOU issues.
This commit is contained in:
1 parent
ddb9d61bde
commit
2abc138bb1
7 files changed
+303
-11
No files matched your search
@@ -23,6 +23,7 @@ import (
|
||||
"github.com/tiennm99/miti99bot/internal/modules/loldle"
|
||||
"github.com/tiennm99/miti99bot/internal/modules/lolschedule"
|
||||
"github.com/tiennm99/miti99bot/internal/modules/misc"
|
||||
"github.com/tiennm99/miti99bot/internal/modules/stats"
|
||||
"github.com/tiennm99/miti99bot/internal/modules/trading"
|
||||
"github.com/tiennm99/miti99bot/internal/modules/twentyq"
|
||||
"github.com/tiennm99/miti99bot/internal/modules/util"
|
||||
@@ -49,6 +50,7 @@ func factories() map[string]modules.Factory {
|
||||
"lolschedule": lolschedule.New,
|
||||
"twentyq": twentyq.New,
|
||||
"trading": trading.New,
|
||||
"stats": stats.New,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user