A Telegram bot that reminds you to drink water every 2 hours — funky messages, streak tracking, no AI or external APIs beyond Telegram.
- Randomized, personality-packed reminder messages (uses your Telegram first name)
- Time-of-day greetings (Good morning / afternoon / evening) based on Indian Standard Time
- Quiet hours — no reminders fire 11 PM–7 AM IST by default, regardless of where it's hosted
- ✅ inline button to log a drink, with streak + total counters
/status,/start,/stopcommands- Data stored in a plain local JSON file — no database required
- Create a bot with @BotFather on Telegram — send
/newbotand follow the prompts. Copy the token it gives you. - Install dependencies:
pip install -r requirements.txt
- Set your bot token as an environment variable:
export TELEGRAM_BOT_TOKEN='your-token-here'
- Run it:
python hydration_bot.py
- Message your bot
/starton Telegram.
Open hydration_bot.py and adjust:
REMINDER_INTERVAL_SECONDS— how often reminders fire (default: 2 hours)QUIET_HOURS_START/QUIET_HOURS_END— the no-reminders window, in 24-hour IST (default: 23 → 7, i.e. 11 PM–7 AM)FUNKY_MESSAGES/CHEER_MESSAGES/GREETINGS— add your own linesDATA_FILE— defaults tohydration_data.json; can be overridden via theDATA_FILEenv var (useful for pointing at a mounted volume on hosts with ephemeral storage)
The bot needs to run continuously to fire reminders (it uses polling, not a public webhook). Options:
- Leave it running on your own computer / a Raspberry Pi
- Deploy as a background service on a host like Railway — see deployment notes below
- Run on a permanently-free VM like an Oracle Cloud Always Free instance
- Push this repo to GitHub, then in Railway: New Project → Deploy from GitHub repo.
- In the service's Variables tab, add
TELEGRAM_BOT_TOKEN. - In Settings → Deploy, set the Custom Start Command to
python hydration_bot.py. - Check the Logs tab for
💧 Hydration bot is running..., then test/starton Telegram. - Optional: add a Railway Volume mounted at
/data, and setDATA_FILE=/data/hydration_data.jsonso your streak survives redeploys.
Note: Railway's free tier includes a 30-day/$5 trial, then drops to $1/month of usage credit — keep an eye on usage in the dashboard.