Skip to content

Repository files navigation

tg-workout-bot

Telegram bot for logging workouts. Manage a personal list of exercises, record sessions (date, weight, reps, sets), view history by date or by exercise, and optionally set profile (height, weight, age).

Requirements

  • Python 3.11+
  • Poetry for dependency management

Setup

  1. Copy the example env file and set your bot token:

    cp .env.example .env
    # Edit .env and set TELEGRAM_BOT_TOKEN (get one from https://t.me/BotFather)
  2. Install dependencies and run migrations:

    poetry install
    poetry run alembic upgrade head
  3. Run the bot:

    poetry run python -m app.main

Environment variables

Variable Required Default Description
TELEGRAM_BOT_TOKEN Yes Telegram bot token from BotFather
LOG_LEVEL No INFO Logging level
SQLITE_DB_PATH No bot.db Path to SQLite database file

Docker

The image uses Poetry inside the container and runs migrations automatically on startup.

Build and run

# Build
docker build -t tg-workout-bot .

# Run (pass token and mount a volume for the DB)
docker run --rm -e TELEGRAM_BOT_TOKEN=your_token_here -v bot-data:/data tg-workout-bot

The container stores the database at /data/bot.db by default. Mount a volume at /data so it persists (e.g. -v bot-data:/data or use the host’s volume mapping).

Docker Compose

For local or single-host runs:

cp .env.example .env
# Set TELEGRAM_BOT_TOKEN in .env

docker compose up --build

This builds the image and loads env from .env. The DB is at /data/bot.db; mount a volume at /data for persistence. The entrypoint runs alembic upgrade head on each start, then starts the bot.

Docker env vars

Same as above: TELEGRAM_BOT_TOKEN is required. Optional: LOG_LEVEL, SQLITE_DB_PATH (default in the image is /data/bot.db).

Deployment

JustRunMy.App

  1. Connect repo - Deploy via Git (push to their URL) or Docker build/push.
  2. Secrets / env - Set TELEGRAM_BOT_TOKEN (from BotFather).
  3. Volume - Map a persistent volume to /data so the DB at /data/bot.db survives restarts.

The bot uses long polling only (no HTTP server). The entrypoint runs alembic upgrade head on each start, then starts the bot. If the platform requires a health-check endpoint to avoid restarts, you would need to add one back (e.g. a small server on a port).

Other (VPS, etc.)

  • VPS: Install Docker (or Python + Poetry), set TELEGRAM_BOT_TOKEN and optionally SQLITE_DB_PATH, run migrations if not using the Docker entrypoint, then start the bot or run the container with a volume.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages