Add games system: euro economy, Hangman, Blackjack, coin flip

Euro economy: virtual currency earned passively per message (tiered by
word count, 30s cooldown). Starting balance seeded from corpus character
count. Balance, leaderboard, and transfer commands. Debt system with
configurable limit.

Hangman: collaborative game with phrase pool loaded from file. ASCII
gallows display, tiered scoring (Easy/Medium/Hard/Extreme), early
solution bonus, participant tracking with DM verification. Community
phrase submission with LLM screening.

Blackjack: 1-2 players vs dealer. Standard casino rules (hit soft 17).
Auto-play on timeout. Bet validation against balance and debt limit.
Blackjack pays 1.5x. Separate leaderboard.

Games channel restriction: all game commands (trivia, hangman, blackjack,
flip) restricted to GAMES_ROOM. Dice (!roll) exempt. Trivia also
restricted.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
prosolis
2026-03-11 18:30:17 -07:00
parent 996bb18566
commit cce5160057
9 changed files with 1989 additions and 1 deletions

View File

@@ -621,6 +621,38 @@ CREATE TABLE IF NOT EXISTS api_cache (
cached_at INTEGER DEFAULT (unixepoch())
);
-- Euro economy
CREATE TABLE IF NOT EXISTS euro_balances (
user_id TEXT PRIMARY KEY,
balance REAL NOT NULL DEFAULT 0,
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE IF NOT EXISTS euro_transactions (
id INTEGER PRIMARY KEY AUTOINCREMENT,
user_id TEXT NOT NULL,
amount REAL NOT NULL,
reason TEXT NOT NULL,
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
);
CREATE INDEX IF NOT EXISTS idx_euro_tx_user ON euro_transactions(user_id, created_at);
-- Hangman scores
CREATE TABLE IF NOT EXISTS hangman_scores (
user_id TEXT PRIMARY KEY,
total_earned REAL NOT NULL DEFAULT 0,
games_played INTEGER NOT NULL DEFAULT 0,
games_won INTEGER NOT NULL DEFAULT 0
);
-- Blackjack scores
CREATE TABLE IF NOT EXISTS blackjack_scores (
user_id TEXT PRIMARY KEY,
total_earned REAL NOT NULL DEFAULT 0,
games_played INTEGER NOT NULL DEFAULT 0,
games_won INTEGER NOT NULL DEFAULT 0
);
-- Moderation: strikes
CREATE TABLE IF NOT EXISTS mod_strikes (
id INTEGER PRIMARY KEY AUTOINCREMENT,