Telegram bot (@KittyKodakAI_bot) that generates AI cat images with freemium limits and TON payments.
- 🤖
/start- Welcome message with bot introduction - 🎨
/cat {prompt}- Generate AI cat image (3 free/day/user, reset daily) - 💎
/pay- Inline TON Connect buttons (0.5 TON/gen or 5 TON/month) with callback verification - 📊
/stats- Shows current usage and Pro expiry - ⚡ English-only interface, webhook-ready for Railway
- 🔒 Secure with aiohttp 3.13.3 (patches CVE vulnerabilities)
- Create
.envfrom template:
cp .env.example .env
Fill BOT_TOKEN, PERPLEXITY_KEY, TON_WALLET, REDIS_URL, WEBHOOK_BASE.
- Install dependencies (Python 3.12):
pip install -r requirements.txt
- Run locally (webhook):
python src/main.py
- Uses
railway.toml(NIXPACKS) andProcfile(web: python src/main.py) - Automatic restart on failure with max 10 retries
- Set environment variables in Railway dashboard
- WEBHOOK_BASE should be your Railway domain (e.g., https://your-app.up.railway.app)
Note: If Railway continues to deploy a stale revision after a PR is merged, trigger a manual redeploy from the Railway dashboard (Deployments → Redeploy) or push a new commit to
mainto force Railway to pick up the latest revision.
src/
├── main.py # aiogram dispatcher, webhook server
├── handlers.py # /start, /cat, /pay, /stats
├── ai_generator.py # Perplexity API call
├── ton_payments.py # TON Connect helpers and checks
└── database.py # Redis limits and Pro status
requirements.txt
.env.example
railway.toml
Procfile
/cat astronaut→ Cute astronaut cat 🚀/cat vaporwave neon beach→ Vibrant neon cat 🌊/pay→ TON payment options 💎/stats→ Usage info and limits 📊
- aiogram 3.24+: Modern Telegram Bot framework with latest features
- aiohttp 3.13.3: Async HTTP client with security patches (zip bomb, DoS, directory traversal CVEs)
- Perplexity API: AI-powered cat image generation
- TON Blockchain: Decentralized payment processing
- Redis: Session storage and rate limiting
- Railway: Cloud deployment platform
MIT License - feel free to use this project for your own purposes.
