Prerequisites
Before you begin, make sure you have the following:- Node.js >= 20 — the bot uses native
structuredCloneand other modern APIs. - A Telegram bot token — create a bot via @BotFather and copy the token.
- An OpenAI API key — required for GPT-4o-mini curation. Get one at platform.openai.com.
Setup
Edit .env with your credentials
Open All other variables have sensible defaults and are optional. See the full list below.
.env and set the two required variables at minimum:Environment variables
| Variable | Required | Default | Description |
|---|---|---|---|
BOT_TOKEN | Yes | — | Telegram bot token from @BotFather |
OPENAI_API_KEY | Yes | — | OpenAI API key |
OPENAI_MODEL | No | gpt-4o-mini | OpenAI model used for curation |
MIN_DISCOUNT_PERCENT | No | 50 | Minimum discount required (%) |
MIN_METACRITIC_SCORE | No | 70 | Minimum Metacritic score (0 to disable) |
MIN_STEAM_RATING_PERCENT | No | 70 | Minimum Steam user rating (%) |
MAX_PRICE_USD | No | 60 | Maximum sale price in USD |
DEALS_PAGE_SIZE | No | 60 | Number of deals to fetch from CheapShark (max 60) |
DEDUP_DAYS | No | 7 | Days before a game can appear again |
CRON_SCHEDULE | No | 0 9 * * * | Cron expression for daily broadcast (9 AM Colombia time) |
The data/ directory
The bot creates a data/ directory at runtime to persist state between restarts. It contains three files:
| File | Purpose |
|---|---|
chat_ids.json | Subscriber chat_id list used for daily broadcasts |
notified_games.json | Deduplication records — prevents repeating the same game within DEDUP_DAYS days |
snapshot.json | Today’s curated deals — served instantly by /deals if already generated |