A simple Telegram bot that automatically rolls dice, stores results, and calculates the average score on request.
Built with Node.js and
node-telegram-bot-api.
- 🎲 Automatically rolls dice every few seconds
- 📥 Stores all dice values in an array
- 📊 Shows roll count, total sum & average
▶️ /start— begin auto dice rolling- ⏹
/stop— stop rolling & show final stats - 📈
/result— instantly view current stats
- Node.js 16+
- Telegram Bot Token from @BotFather
git clone <repo-url>
cd dice
npm installCreate a .env file:
BOT_TOKEN=your_telegram_bot_token_herenode index.js- Bot uses
setInterval()to roll dice continuously - Each result is pushed into an array
/resultor/stopcalculates:- total rolls
- sum of values
- average value
dice/
├─ index.js
├─ .env
├─ package.json
└─ node_modules/
| Command | Description |
|---|---|
/start |
Start auto dice rolling |
/result |
Show stats & average |
/stop |
Stop and display final results |
Free to use, modify, and improve 🎯
Happy rolling! 🎲😄