No description
  • Rust 96.7%
  • Dockerfile 3.3%
Find a file
Paweł J. Wal 0deecd6fe5
All checks were successful
Build and deploy / build (push) Successful in 3m8s
Build and deploy / deploy (push) Successful in 39s
Merge pull request 'Add concise shopping chat commands' (#4) from furina/message-shorthands into main
Reviewed-on: #4
2026-08-24 10:52:22 +00:00
.forgejo Opus: use rustls exclusively for Telegram 2026-08-24 09:47:26 +00:00
deploy Opus: let shopping-bot own its Kubernetes release 2026-08-24 08:58:24 +00:00
docs/plans Opus: add HTTP API implementation plan 2026-02-22 10:07:21 +01:00
src Opus: add concise shopping chat commands 2026-08-24 10:33:26 +00:00
.dockerignore initial commit 2025-09-20 20:32:26 +02:00
.env.example initial commit 2025-09-20 20:32:26 +02:00
.gitignore fix packaging 2025-09-20 20:48:10 +02:00
Cargo.lock Opus: use rustls exclusively for Telegram 2026-08-24 09:47:26 +00:00
Cargo.toml Opus: use rustls exclusively for Telegram 2026-08-24 09:47:26 +00:00
docker-compose.yml Opus: fix review findings — error handling, empty token, stale comment 2026-02-22 10:16:03 +01:00
Dockerfile Opus: use rustls exclusively for Telegram 2026-08-24 09:47:26 +00:00
README.md Opus: add concise shopping chat commands 2026-08-24 10:33:26 +00:00

Shopping Bot

A Telegram bot for managing shopping lists with SQLite persistence.

Features

  • Add items to shopping list
  • Remove items by ID
  • View current list
  • Clear entire list
  • Persistent storage using SQLite
  • Multi-chat support with optional access control

Commands

  • /help - Display available commands
  • /add <item> - Add an item to the shopping list
  • /remove <id> - Remove an item by its ID
  • /show - Display the current shopping list
  • /clear - Clear the entire shopping list

Ordinary messages also support concise input:

  • a <item> - Add an item
  • r <id> - Remove an item
  • s - Show the list

Legacy /add and /remove responses include a hint for the equivalent concise form.

Deployment

Kubernetes

Pushes to main build the container in Forgejo Actions, publish it to registry.pjw.lol/pawel/shopping-bot, and deploy the immutable image digest using the manifests in deploy/. The cluster must provide the shopping-bot-secret application secret and registry-pull image pull secret in the default namespace.

Using Docker Compose

  1. Clone the repository
  2. Copy .env.example to .env and configure:
    cp .env.example .env
    
  3. Edit .env and set your bot token:
    BOT_TOKEN=your_bot_token_from_botfather
    
  4. (Optional) Set allowed chat IDs for access control:
    ALLOWED_CHAT_IDS=123456789,-987654321
    
  5. Build and run:
    docker-compose up -d
    

Using Docker

Build the image:

docker build -t shopping-bot .

Run the container:

docker run -d \
  --name shopping-bot \
  -e BOT_TOKEN=your_bot_token \
  -e ALLOWED_CHAT_IDS=123456789,-987654321 \
  -v shopping-bot-data:/data \
  shopping-bot

Local Development

  1. Install Rust
  2. Set environment variables:
    export BOT_TOKEN=your_bot_token
    export ALLOWED_CHAT_IDS=123456789,-987654321  # Optional
    
  3. Run the bot:
    cargo run
    

Environment Variables

  • BOT_TOKEN (required): Your Telegram bot token from @BotFather
  • ALLOWED_CHAT_IDS (optional): Comma-separated list of allowed chat IDs. Leave empty to allow all chats.
  • RUST_LOG (optional): Log level (error, warn, info, debug, trace)

Data Storage

  • In Docker: Data is stored in /data/shopping_list.db (persisted via volume)
  • Local development: Data is stored in /tmp/shopping_list.db