mirror of
https://github.com/tiennm99/miti99bot.git
synced 2026-09-18 04:19:54 +00:00
Extend the stats module to track per-user counts in addition to the existing per-command totals. CommandHook now receives the originating *models.Update so the hook can attribute invocations to a user; only the stats module consumes this hook today. Schema (sort keys under pk="stats"): count:<cmd> existing, per-command total user:<id> new, per-user total with cached username pair:<cmd>:<id> new, per (command, user) pair Subcommands (all public): /stats top commands (unchanged) /stats users top users overall /stats user <name> top commands for that user /stats cmd <name> top users of that command When the sender has no Telegram username the per-user/pair writes are skipped — the global per-command counter still increments. View helpers fan out KV reads in parallel to stay inside the webhook deadline. The existing read-modify-write race is unchanged; closing it would need atomic UpdateItem ADD on the KV interface.
101 lines
2.3 KiB
JSON
101 lines
2.3 KiB
JSON
{
|
|
"commands": [
|
|
{
|
|
"command": "help",
|
|
"description": "Show all available commands"
|
|
},
|
|
{
|
|
"command": "info",
|
|
"description": "Show chat, thread, and sender IDs"
|
|
},
|
|
{
|
|
"command": "ping",
|
|
"description": "Health check; replies pong"
|
|
},
|
|
{
|
|
"command": "wordle",
|
|
"description": "Classic wordle; guess the 5-letter word"
|
|
},
|
|
{
|
|
"command": "wordle_new",
|
|
"description": "Start a new wordle round"
|
|
},
|
|
{
|
|
"command": "wordle_giveup",
|
|
"description": "Reveal the current wordle answer"
|
|
},
|
|
{
|
|
"command": "wordle_stats",
|
|
"description": "Show your wordle stats"
|
|
},
|
|
{
|
|
"command": "loldle",
|
|
"description": "Classic loldle; guess the champion"
|
|
},
|
|
{
|
|
"command": "loldle_giveup",
|
|
"description": "Reveal the current loldle answer"
|
|
},
|
|
{
|
|
"command": "loldle_stats",
|
|
"description": "Show your loldle stats"
|
|
},
|
|
{
|
|
"command": "lolschedule",
|
|
"description": "LoL matches for a date"
|
|
},
|
|
{
|
|
"command": "lolschedule_today",
|
|
"description": "Today's LoL esports matches"
|
|
},
|
|
{
|
|
"command": "lolschedule_week",
|
|
"description": "LoL matches for the next 7 days"
|
|
},
|
|
{
|
|
"command": "lolschedule_subscribe",
|
|
"description": "Get the daily LoL schedule digest"
|
|
},
|
|
{
|
|
"command": "lolschedule_unsubscribe",
|
|
"description": "Stop the daily LoL schedule digest"
|
|
},
|
|
{
|
|
"command": "twentyq",
|
|
"description": "20 questions; ask yes/no questions"
|
|
},
|
|
{
|
|
"command": "twentyq_giveup",
|
|
"description": "Reveal the current twentyq answer"
|
|
},
|
|
{
|
|
"command": "twentyq_stats",
|
|
"description": "Show your twentyq stats"
|
|
},
|
|
{
|
|
"command": "trade_topup",
|
|
"description": "Top up VND to your trading account"
|
|
},
|
|
{
|
|
"command": "trade_buy",
|
|
"description": "Buy VN stock at market price"
|
|
},
|
|
{
|
|
"command": "trade_sell",
|
|
"description": "Sell VN stock back to VND"
|
|
},
|
|
{
|
|
"command": "trade_convert",
|
|
"description": "Currency exchange"
|
|
},
|
|
{
|
|
"command": "trade_stats",
|
|
"description": "Show portfolio summary with P&L"
|
|
},
|
|
{
|
|
"command": "stats",
|
|
"description": "Stats. Try: /stats users, /stats user <name>, /stats cmd <name>"
|
|
}
|
|
]
|
|
}
|