Telegram bot that sends reminders for the Tabex (cytisine) 25-day course. Uses long polling and a background scheduler. Data is stored in a local data.json file (no database).
Disclaimer: This bot is a reminder only and does not replace medical advice or consultation with a doctor.
- No webhooks — long polling only
- Single process — bot and scheduler run in one process
- Scheduler — loop every 60 seconds: morning message (08:00), dose reminders, 21:00 missed check, pending (15 min) reminders
- Storage —
data.jsonwith user data (start date, timezone, current day, doses taken, etc.)
-
Create a virtual environment and install dependencies:
python3.11 -m venv .venv source .venv/bin/activate # Windows: .venv\Scripts\activate pip install -r requirements.txt
-
Set the Telegram bot token:
export TELEGRAM_TOKEN=your_bot_token_here -
Run the bot:
python main.py
-
Create a new Background Worker on Render:
- New → Background Worker
- Connect your repository (or push this project to GitHub/GitLab and connect it).
-
Build & run:
- Runtime: Python 3
- Build Command:
pip install -r requirements.txt - Start Command:
python main.py
(Render will use theProcfile:worker: python main.pyif you use the Procfile-based setup.)
-
Environment:
- Add environment variable:
- Key:
TELEGRAM_TOKEN - Value: your bot token from @BotFather
- Key:
- Add environment variable:
-
Сохранить данные пользователей на диске (Persistent Disk):
По умолчанию файловая система Render эфемерная — при перезапуске или новом деплоеdata.jsonтеряется. Чтобы данные сохранялись:- В Render Dashboard открой свой Background Worker → вкладка Disks (или Settings).
- Нажми Add Disk (Persistent Disk).
- Mount Path: укажи
/data(именно эта папка будет постоянной). - Size: например 1 GB. Сохрани.
- В Environment добавь переменную:
- Key:
DATA_PATH - Value:
/data/data.json
- Key:
- После следующего деплоя бот будет писать и читать
data.jsonс постоянного диска — данные переживут перезапуски и новые деплои.
-
Deploy. The worker will start and the bot will run with long polling and the 60-second scheduler.
- The bot stores only the data necessary for reminders: Telegram user ID, start date of the course, timezone offset, current day, doses taken, and reminder state.
- Data is stored in a single file (
data.json) on the server (or on persistent storage if configured). - We do not share your data with third parties. We do not use your data for analytics or advertising.
- You can stop using the bot at any time. To request deletion of your data, contact the operator (insert your contact here).
- This bot does not provide medical advice; it only sends reminders. Always follow your doctor’s instructions.
{
"users": {
"<telegram_id>": {
"startDate": "YYYY-MM-DD",
"timezone": "+5",
"currentDay": 1,
"takenToday": 0,
"lastDoseTimestamp": null,
"courseCompleted": false,
"lastMorningMessageDate": null,
"nextReminderTimestamp": null,
"postponedReminderTimestamp": null
}
}
}Reminders are not at fixed clock times. The next reminder is sent N hours after the user confirms the previous dose (or after the morning «Готово»).
| Days | Doses per day | Interval between doses |
|---|---|---|
| 1–3 | 6 | каждые 2 часа |
| 4–12 | 5 | каждые 2,5 часа |
| 13–16 | 4 | каждые 3 часа |
| 17–20 | 3 | каждые 5 часов |
| 21–25 | 2 | каждые 12 часов |
Use at your own responsibility. Not medical advice.