No description
- Rust 96.7%
- Dockerfile 3.3%
|
|
||
|---|---|---|
| .forgejo | ||
| deploy | ||
| docs/plans | ||
| src | ||
| .dockerignore | ||
| .env.example | ||
| .gitignore | ||
| Cargo.lock | ||
| Cargo.toml | ||
| docker-compose.yml | ||
| Dockerfile | ||
| README.md | ||
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 itemr <id>- Remove an items- 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
- Clone the repository
- Copy
.env.exampleto.envand configure:cp .env.example .env - Edit
.envand set your bot token:BOT_TOKEN=your_bot_token_from_botfather - (Optional) Set allowed chat IDs for access control:
ALLOWED_CHAT_IDS=123456789,-987654321 - 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
- Install Rust
- Set environment variables:
export BOT_TOKEN=your_bot_token export ALLOWED_CHAT_IDS=123456789,-987654321 # Optional - Run the bot:
cargo run
Environment Variables
BOT_TOKEN(required): Your Telegram bot token from @BotFatherALLOWED_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