An AI-powered Telegram bot that helps pet owners by answering questions about pet health using the Anthropic Claude AI model.
- Answers pet health-related questions using Anthropic's Claude AI
- Provides helpful and compassionate advice
- Always recommends consulting with a veterinarian for serious medical conditions
- Easy to use through Telegram messaging
- Go 1.21 or later
- Telegram Bot Token (obtain from @BotFather)
- Anthropic API Key (obtain from Anthropic Console)
- Clone the repository:
git clone https://github.com/ksysoev/help-my-pet.git
cd help-my-pet- Install dependencies:
go mod download- Create a configuration file:
cp config.yaml config.local.yaml- Edit
config.local.yamland add your API keys:
bot:
telegram_token: "your-telegram-bot-token" # Required: Your Telegram bot token from BotFather
rate_limit:
user_hourly_limit: 5 # Maximum number of requests per hour per user
user_daily_limit: 15 # Maximum number of requests per day per user
global_daily_limit: 1000 # Maximum total requests per day across all users
whitelist_ids: [] # List of user IDs exempt from rate limiting
ai:
model: "claude-2" # Optional: Anthropic model to use (default: claude-2)
api_key: "" # Required: Your Anthropic API key
max_tokens: 1000 # Optional: Maximum tokens in response (default: 1000)- Start the bot:
go run cmd/help-my-pet/main.go bot --config config.local.yaml- Open Telegram and start chatting with your bot
- Ask any pet health-related questions
- Run tests:
go test ./...- Run linter:
golangci-lint runYou can run the bot using Docker in the following ways:
- Pull the image:
docker pull ghcr.io/ksysoev/help-my-pet:latest-
Create your config file as described in the Installation section
-
Run the container:
docker run -v $(pwd)/config.local.yaml:/app/config.yaml ghcr.io/ksysoev/help-my-pet bot- Build the image:
docker build -t help-my-pet .- Run the container:
docker run -v $(pwd)/config.local.yaml:/app/config.yaml help-my-pet botThe application is deployed to production using GitHub Actions and the cloudlab deployment workflow.
- Docker Swarm initialized on the cloudlab server
- GitHub Actions secrets configured
- Bot images published to GitHub Container Registry (ghcr.io)
Set up the following secrets in your GitHub repository (Settings → Secrets and variables → Actions):
SSH Connection:
DO_SSH_PRIVATE_KEY- SSH private key for accessing the cloudlab serverDO_HOST- Cloudlab server IP address (e.g.,167.172.190.133)DO_USER- SSH username for deployment (e.g.,deployer)
Application Secrets:
TELEGRAM_TOKEN- Telegram bot token from @BotFatherANTHROPIC_API_KEY- Anthropic API key from Anthropic ConsoleCODECOV_TOKEN- Codecov token for coverage reports
Environment Variable Mapping:
TELEGRAM_TOKEN(GitHub secret) →BOT_TELEGRAM_TOKEN(container)ANTHROPIC_API_KEY(GitHub secret) →AI_API_KEY(container)
The deployment is fully automated via GitHub Actions:
- On Pull Request: Build and test the Docker image (amd64 only)
- On Tag Push (e.g.,
v1.0.0):- Build multi-arch Docker images (amd64, arm64)
- Push images to GitHub Container Registry
- Deploy to production using the cloudlab workflow
- Automatic rollback on failure
To deploy a new version:
git tag v1.0.0
git push origin v1.0.0Manual deployment (if needed):
# SSH to the cloudlab server
ssh -p 1923 deployer@167.172.190.133
# Navigate to deployment directory
cd ~/cloudlab/stacks/helpmypet
# Deploy the stack
docker stack deploy -c docker-compose.yml helpmypetCheck service status:
ssh -p 1923 deployer@167.172.190.133
docker stack ps helpmypetView service logs:
# Bot logs
docker service logs -f helpmypet_help-my-pet
# Redis logs
docker service logs -f helpmypet_redisHealth check:
# Check if services are running
docker service ls | grep helpmypetIf deployment fails, the system automatically rolls back to the previous version. For manual rollback:
docker service update --rollback helpmypet_help-my-petcmd/help-my-pet/- Main application entry pointpkg/bot/- Telegram bot service implementationcore/- Core business logic and AI servicecmd/- Command line interface and configuration
This project is licensed under the MIT License - see the LICENSE file for details.