OmegaBot records gameplay data for analytics and leaderboards.
The game_usage_daily table tracks how often each command is used per user per day.
CREATE TABLE game_usage_daily (
date TEXT NOT NULL, -- YYYY-MM-DD (UTC)
command TEXT NOT NULL, -- e.g. "slots", "blackjack", "dice"
user_id TEXT NOT NULL,
count INTEGER NOT NULL DEFAULT 1,
PRIMARY KEY (date, command, user_id)
);slots,blackjack,rps,trivia,hangman,wordleconnect4,tictactoe,dice,coinflip,darts
This same daily usage data also powers rotating quest progress where relevant.
Data is recorded automatically when users run these commands. No configuration required.
Query examples (via SQL or a custom admin tool):
- Today's total plays for a command:
SELECT SUM(count) FROM game_usage_daily WHERE date = ? AND command = ? - Today's plays for a user:
SELECT SUM(count) FROM game_usage_daily WHERE date = ? AND user_id = ? - Most active command today:
SELECT command, SUM(count) as total FROM game_usage_daily WHERE date = ? GROUP BY command ORDER BY total DESC
- Dates are UTC. Use
date(new Date().toISOString().slice(0,10))or equivalent for "today". - Data is cumulative;
ON CONFLICT ... DO UPDATEincrementscountfor repeat plays. - Table is created automatically on first use (or via
migrations/schema.sqlon init).
The command_usage_daily table tracks non-game command usage (help, profile, ping, etc.) per user per day. Game commands use game_usage_daily instead.
CREATE TABLE command_usage_daily (
date TEXT NOT NULL,
command TEXT NOT NULL,
user_id TEXT NOT NULL,
count INTEGER NOT NULL DEFAULT 1,
PRIMARY KEY (date, command, user_id)
);All slash commands except the game commands listed above (slots, blackjack, dice, etc.).
src/services/analytics/commandUsageStore.ts – recordCommandUsage() is called from the interaction handler on successful command execution.