Telegram bot for solving a Rubik's cube.
/start— begins a new game: a fresh 3x3 cube is scrambled and sent as a rich message with the rendered cube, a collapsible move log and move buttons. An optional scramble can be given, either as notation moves (/start R U F' L) or as a scramble length (/start 40);/startalone produces a random scramble.- Tap the move buttons (F, F', B, B', U, U', D, D', L, L', R, R') to rotate the cube. The board is redrawn in place after every move and the move log grows without length limits.
- Once the cube is solved, the bot congratulates you.
/stats— shows your finished-game statistics (total, solved vs abandoned, average and best move counts)./stop— ends your current (active) game. Finished games are kept for reference; send/startto play again./help— shows available commands.
The picture shows the cube from two orthographic perspectives side by side with the unfolded net in the corner. The board is delivered as a Telegram rich message: the cube photo, a collapsible move log and the move buttons are all part of the same message and are updated with a single edit per move. Sessions, the scramble and every applied move are persisted so a game survives restarts.
Ended games — both solved and abandoned — are kept as history for later
analysis. History per chat is bounded to the newest
HISTORY_LIMIT_PER_CHAT ended sessions; the active game is never trimmed.
Environment variables (loaded from .env if present):
BOT_TOKEN— required, Telegram bot token.LOG_LEVEL— optional, zerolog level (defaultinfo).DB_PATH— optional, path to the SQLite database (defaultrubix.db).HISTORY_LIMIT_PER_CHAT— optional, ended sessions kept per chat (default500).SHUTDOWN_TIMEOUT— optional, grace period for in-flight work on shutdown (default5s).SOCKS5_PROXY— optional SOCKS5 proxy address (host:portorsocks5://host:port). Empty means a direct connection.SOCKS5_USER/SOCKS5_PASS— optional credentials for an authenticated SOCKS5 proxy.
cp .env.example .env # set BOT_TOKEN
go run ./cmd/bot- Multiplayer voting mode: several users solve one cube together by voting for the next move.
- Per-move move-count column to offload stats aggregation to SQL.