Files
tiennm99 629b513c91 feat(games): move /wordle and /loldle to the web games and add /loldledaily
/wordle and /loldle now send the wordle and loldle BotFather games in an
unlimited mode: each player gets their own word or champion, saved after
every guess, with a New game button. Cards the bot did not record as
unlimited, including the daily cards, play the daily puzzle. The helper
commands keep working on the player's round.

/loldledaily mirrors /wordledaily: one champion per day at 07:00 ICT,
subscribe and unsubscribe, the morning recap and the live group results.

The daily and unlimited machinery is shared in util/guessgame, the old
in-chat wordle module is removed, and a one-time startup migration carries
each player's stats and unfinished round over without changing old data.
2026-10-10 09:29:48 +07:00

89 lines
4.5 KiB
Bash

# tiennm99bot — self-host (Coolify + MongoDB Atlas) environment.
# Copy to .env and fill in. .env is gitignored — never commit real secrets.
# ============================ Required ============================
# Telegram bot token from @BotFather.
TELEGRAM_BOT_TOKEN=123456:ABC-DEF...
# MongoDB Atlas connection. MONGO_URL is the full SRV string INCLUDING the
# db username + password — treat it as a secret (it is never logged).
# Create a least-privilege user: readWrite on this one database only.
MONGO_URL=mongodb+srv://botuser:STRONG_UNIQUE_PASSWORD@cluster0.xxxxx.mongodb.net/?retryWrites=true&w=majority
MONGO_DATABASE=tiennm99bot
# ============================ Operational =========================
# Comma-separated module list. Empty = load every module, including any module
# added later — so list them explicitly when a deployment should only gain a new
# module deliberately. wordledaily serves /wordle too; the retired name wordle
# still loads it.
MODULES=util,misc,random,amlich,wordledaily,loldle,noitu,lol,stock,gold,coin,stats,monkeyd,sticker,alias,blacklist,weather
# Telegram user id for owner-only commands.
OWNER_ID=
# Comma-separated admin Telegram user ids.
ADMIN_IDS=
# Bot's Telegram username, without "@". Unset = asked from Telegram (getMe)
# once at startup. Used for the default sticker pack name and the lol
# User-Agent. Set it to skip that call or to pin the value.
BOT_USERNAME=
# Sticker set /addsticker writes to. Every user contributes to this one pack.
# MUST end in _by_<this bot username>: Telegram requires that suffix on sets a
# bot creates and refuses to edit sets it did not create, so the suffix is what
# proves the pack is manageable. Created automatically, owned by OWNER_ID, on
# the first /addsticker if it does not exist yet. Unset = stickers_by_<bot username>.
STICKER_PACK_NAME=
# SOURCE_COMMIT (commit SHA) is read at startup for the deploynotify owner DM.
# Do NOT set it here. Coolify provides it at runtime. Keep "Include Source
# Commit in Build" disabled so Docker layer cache survives across commits.
# Local `docker compose up` has none, so deploynotify reports "unknown".
# PandaScore API token for the lol module's schedule fetches (free tier at
# https://app.pandascore.co/dashboard, no credit card). Secret — never logged.
# Without it every /lol* fetch fails; the stale cache covers ≤60 min.
LOL_PANDASCORE_TOKEN=
# Optional base URL of the animation renderer (the renderer/ service in this
# repository) for /wheelofnames, /gacha and /genshin, e.g.
# http://localhost:3000. compose.yml fixes it to http://renderer:3000, so set it
# only when running the bot outside compose. Leave blank to fall back to text.
RENDERER_URL=
# Optional public HTTPS base URL for the noitu HTML5 game, e.g.
# https://noitu.example.com. It must route to the bot container's port 8080
# (attach a Coolify domain to the bot service); the game page is served under
# <GAME_BASE_URL>/games/noitu/. Unset or invalid = the game is disabled: /noitu
# still sends the game, Play explains it is not configured, and no /games/
# route exists. See docs/noitu-game.md.
GAME_BASE_URL=
# Optional secret (at least 32 bytes) that signs noitu game links. Unset = a key
# derived from TELEGRAM_BOT_TOKEN, so rotating the bot token invalidates open
# game links. A value shorter than 32 bytes disables the game. Secret.
NOITU_GAME_SECRET=
# Optional secret (at least 32 bytes) for the wordledaily game: it signs game
# links and keys the daily answer order. Unset = derived from
# TELEGRAM_BOT_TOKEN. A value shorter than 32 bytes disables the game. The game
# is also served under <GAME_BASE_URL>/games/wordledaily/. See
# docs/wordledaily.md. Secret.
WORDLEDAILY_GAME_SECRET=
# Optional secret (at least 32 bytes) for the loldle game: it signs game links
# and keys the LoLdle Daily champion order. Unset = derived from
# TELEGRAM_BOT_TOKEN. A value shorter than 32 bytes disables the web game; the
# in-chat /loldle commands keep working. Served under
# <GAME_BASE_URL>/games/loldle/. See docs/loldle.md. Secret.
LOLDLE_GAME_SECRET=
# ====================== Leave UNSET on self-host ==================
# Defaults are correct for self-host:
# KV_PROVIDER — auto-selects mongodb because MONGO_URL is set
# PORT — defaults to 8080 (health server, plus the noitu game
# when GAME_BASE_URL is set)
# TELEGRAM_WEBHOOK_SECRET — long polling has no webhook
# GOLD_VNAPP_API_KEY — gold module auto-fetches + caches the key to Mongo
# Stock/coin/gold URL env overrides are not supported; modules use coded
# default providers.