Alita is a powerful, modern Telegram group management bot built with Go and the Gotgbot library. Designed for speed, reliability, and extensive customization, Alita provides comprehensive moderation tools for Telegram communities of any size.
Get Alita running in under 5 minutes!
git clone https://github.com/divkix/Alita_Robot.git
cd Alita_Robot
cp sample.env .env
# Edit .env with your configuration
nano .env
Required variables:
BOT_TOKEN=your_bot_token_from_botfather
OWNER_ID=your_telegram_user_id
MESSAGE_DUMP=-100xxxxxxxxx # Your log channel
DATABASE_URL=postgres://postgres:password@postgres:5432/alita_robot
REDIS_ADDRESS=redis:6379
docker compose up -d
That's it! Your bot should now be running. Check the logs:
docker compose logs -f alita
Open Telegram and search for your bot username to start using it!
Note: After deploying, configure the required environment variables (
BOT_TOKEN,OWNER_ID,MESSAGE_DUMP) in your platform's dashboard.
Platform-specific notes:
We provide official Docker images at ghcr.io/divkix/alita_robot for easy
deployment.
This includes PostgreSQL, Redis, and the bot:
# Clone the repository
git clone https://github.com/divkix/Alita_Robot.git
cd Alita_Robot
# Configure environment
cp sample.env .env
# Edit .env with your settings
# Start all services
docker compose up -d
# View logs
docker compose logs -f alita
# Stop services
docker compose down
Note: Database migrations run automatically in Docker (AUTO_MIGRATE=true).
Optional: To run a local Telegram Bot API server for faster file handling, use
the compose profile and set API_SERVER in your .env:
# .env
API_SERVER=http://telegram-bot-api:8081
TELEGRAM_API_ID=your_api_id
TELEGRAM_API_HASH=your_api_hash
# Start with profile
docker compose --profile local-bot-api up -d
If you have existing PostgreSQL and Redis instances:
docker run -d \
--name alita-bot \
--restart unless-stopped \
-e BOT_TOKEN="your_bot_token" \
-e DATABASE_URL="your_postgres_url" \
-e REDIS_ADDRESS="your_redis_address" \
-e OWNER_ID="your_telegram_id" \
-e MESSAGE_DUMP="-100xxxxxxxxx" \
ghcr.io/divkix/alita_robot:latest
Download pre-built binaries for your platform:
alita_robot_*_linux_amd64.tar.gz or _arm64alita_robot_*_darwin_amd64.tar.gz or _arm64Windows: alita_robot_*_windows_amd64.zip
Extract and run:
# Linux/macOS
tar -xzf alita_robot_*.tar.gz
chmod +x alita_robot
./alita_robot
# Windows
# Extract the zip file and run alita_robot.exe
# Clone the repository
git clone https://github.com/divkix/Alita_Robot.git
cd Alita_Robot
# Install dependencies
go mod download
# Build the binary
go build -o alita_robot .
# Or use make
make build
# Run the bot
./alita_robot
# (Recommended) Run database migrations before the first run
# Provide your Postgres connection via env vars:
# PSQL_DB_HOST, PSQL_DB_NAME, PSQL_DB_USER, PSQL_DB_PASSWORD
# Optional: PSQL_DB_PORT (default 5432), PSQL_DB_SSLMODE (default require)
make psql-migrate
# Run with hot reload (requires air)
go install github.com/cosmtrek/air@latest
air
# Or use make
make run
Alita uses environment variables for configuration. Create a .env file in the
project root:
| Variable | Description | Example |
|---|---|---|
BOT_TOKEN |
Telegram Bot Token from @BotFather | 123456:ABC-DEF... |
DATABASE_URL |
PostgreSQL connection string | postgres://user:pass@host/db |
REDIS_ADDRESS |
Redis server address | redis:6379 |
OWNER_ID |
Your Telegram user ID | 123456789 |
MESSAGE_DUMP |
Log channel ID (must start with -100) | -100123456789 |
| Variable | Description | Default |
|---|---|---|
REDIS_PASSWORD |
Redis password | (empty) |
ENABLED_LOCALES |
Comma-separated locale codes | en |
USE_WEBHOOKS |
Enable webhook mode | false |
WEBHOOK_DOMAIN |
Webhook domain (if enabled) | - |
WEBHOOK_SECRET |
Webhook security token | - |
HTTP_PORT |
Unified server port (health, metrics, webhook) | 8080 |
DEBUG |
Enable verbose logging | false |
AUTO_MIGRATE |
Auto-apply SQL migrations on startup | false |
DROP_PENDING_UPDATES |
Drop pending updates on start | true |
See sample.env for the complete list of configuration options including
database pool tuning, worker pool sizes, monitoring, and performance settings.
For production deployments, webhook mode provides better performance and lower resource usage than polling. Alita supports webhooks with Cloudflare Tunnel for easy setup behind firewalls.
alita-telegram-bot)--token)alita-bot (or your preference)http://alita:8080/webhook/your-secret (replace with your actual
WEBHOOK_SECRET)Create your .env file with webhook settings:
# Bot Configuration
BOT_TOKEN=your_bot_token_here
OWNER_ID=your_telegram_user_id
MESSAGE_DUMP=-100xxxxxxxxx
# Database Configuration
DATABASE_URL=postgres://postgres:password@postgres:5432/alita_robot?sslmode=disable
REDIS_ADDRESS=redis:6379
REDIS_PASSWORD=your_redis_password
# Webhook Configuration
USE_WEBHOOKS=true
WEBHOOK_DOMAIN=https://alita-bot.yourdomain.com
WEBHOOK_SECRET=your-random-secret-string-here
HTTP_PORT=8080
# Cloudflare Tunnel
CLOUDFLARE_TUNNEL_TOKEN=eyJhIjoiNzU1...your-tunnel-token-here
Uncomment the cloudflared service in your docker-compose.yml:
# Uncomment this section for webhook mode
cloudflared:
image: cloudflare/cloudflared:latest
container_name: alita-cloudflared
environment:
- TUNNEL_TOKEN=${CLOUDFLARE_TUNNEL_TOKEN}
command: tunnel --no-autoupdate run
restart: unless-stopped
depends_on:
- alita
deploy:
resources:
limits:
memory: 128M
cpus: "0.1"
After your bot is running, register the webhook URL with Telegram:
```bash
$ claude mcp add Alita_Robot \
-- python -m otcore.mcp_server <graph>