Kramer's Deals
@kramerbot
https://t.me/kramerbot
A Telegram bot to get you the latest deals from websites like https://www.ozbargain.com.au and https://amazon.com.au. Let Kramer watch deals so you don't have to. Giddy up!
Note: This version is CLI-only and does not include a web interface or API.Features
1.
2.
3.
4.
data/users.db
by default)
5.
6.
7.
8.
9.
API
The following API endpoints are available -
1/users - Get user data for all users
2/users/:chatid - Get user data by chat id
3/deals - Get deal data for latest deals by the scraper
4/signup - Signup from accompanying web app https://www.github.com/intothevoid/kramerbotui
5/preferences - Update user preferences
6/authenticate - User authentication
Deployment
Configuration is primarily managed via config.yaml
. However, sensitive information like tokens should be set via environment variables. Kramerbot can be deployed using the following command after setting the required environment variables:
1go build .
2./kramerbot
Required environment variables
These environment variables override values in config.yaml
if set.
1TELEGRAM_BOT_TOKEN=<your_telegram_bot_token> # Mandatory
2KRAMERBOT_ADMIN_PASS=<your_admin_password> # Optional: If admin commands are used
3SQLITE_DB_PATH=<path_to_your_sqlite_db_file> # Optional: Defaults to value in config.yaml or 'data/users.db'
config.yaml
for other configuration options like logging, scraper intervals, etc.)
Setup Database (SQLite)
The bot uses a SQLite database file to store user data. By default, it will create/use a file at ./data/users.db
relative to where the bot is run.
•
./data
exists and the bot has write permissions.
•
sqlite.db_path
setting in config.yaml
or the SQLITE_DB_PATH
environment variable.
Using Docker
To build a Docker image of Kramerbot:
1sudo docker build -t kramerbot:latest .
Create an environment file (e.g., kramerbot.env
) with your required variables:
1TELEGRAM_BOT_TOKEN=<your_telegram_bot_token>
2KRAMERBOT_ADMIN_PASS=<your_admin_password> # Optional
3SQLITE_DB_PATH=/app/data/users.db # Optional: Specify path inside the container
To deploy your container using Docker Compose (recommended for persisting data):
1.
docker-compose.yaml
file similar to the one provided in the repository (it should handle mounting the ./data
directory).
2.
docker compose up -d
Alternatively, to run directly with docker run
:
1# Create the data directory on your host first if it doesn't exist
2mkdir -p data
3
4# Run the container, mounting the local data directory
5sudo docker run -d --name kramerbot \
6 --env-file ./kramerbot.env \
7 -v "$(pwd)/data:/app/data" \
8 --restart unless-stopped \
9 kramerbot:latest
./data
directory into /app/data
inside the container, where the bot expects to find the SQLite file by default or via the environment variable.)
