# Telegram Bot Setup - zCode CLI X

## ✅ Status: RUNNING

Your zCode CLI X Telegram bot is now **live and running 24/7**!

## 📊 Current Configuration

- **Bot Token**: Configured via `.env` (`TELEGRAM_BOT_TOKEN`)
- **Allowed Users**: Configured via `.env` (`TELEGRAM_ALLOWED_USERS`)
- **API**: Z.AI GLM-5.1 (Coding Plan)
- **Port**: Configured via `ZCODE_PORT` (default: 3001)
- **Service**: systemd (auto-start on boot)

## 🚀 How to Use

### Via Telegram

1. Open Telegram
2. Search for your bot
3. Send `/start` to initialize
4. Start chatting!

### Check Status

```bash
# Check service status
sudo systemctl status zcode

# View logs
tail -f logs/zcode.log

# Restart service
sudo systemctl restart zcode

# Stop service
sudo systemctl stop zcode
```

## 🔗 Webhook Status

Webhook is **configured and active**. To receive real messages:

1. Get a public URL (e.g., use ngrok):
   ```bash
   ngrok http 3001
   ```

2. Set the webhook URL:
   ```bash
   curl -F "url=https://your-domain.com/telegram/webhook" \
     "https://api.telegram.org/bot<YOUR_TOKEN>/setWebhook"
   ```

3. Verify webhook:
   ```bash
   curl "https://api.telegram.org/bot<YOUR_TOKEN>/getWebhookInfo"
   ```

## 🛠️ Available Commands

- `/start` - Start the bot
- `/help` - Show help
- `/status` - Check system status
- `/agents` - List available agents
- `/skills` - List available skills

## 🎯 Features

✅ **Z.AI Integration**: GLM-5.1 model
✅ **Tools**: Bash, FileEdit, WebSearch, Git
✅ **Agents**: Code Reviewer, Architect, DevOps
✅ **Skills**: code_review, bug_fix, refactor, etc.
✅ **24/7 Uptime**: systemd service
✅ **Real-time**: WebSocket support

## 📝 Next Steps

1. **Set bot name**: Talk to @BotFather
2. **Enable webhook**: Use ngrok for local dev
3. **Customize**: Add more tools and skills
4. **Monitor**: Check logs regularly

---

**zCode CLI X is ready! Start chatting via Telegram!** 🚀⚡
