ai-telegram-bot / setup.sh
abbasyk60's picture
One-click VPS setup script
c37faf4 verified
Raw
History Blame Contribute Delete
2.79 kB
#!/bin/bash
# OpenClaw Telegram Bot - One-Click Setup for Ubuntu VPS
# Run this: curl -sSL https://raw.githubusercontent.com/abbasyk60/openclaw/main/setup.sh | bash
set -e
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m'
echo -e "${GREEN}"
echo "============================================"
echo " OpenClaw Telegram Bot - One-Click Setup"
echo "============================================"
echo -e "${NC}"
# Check if running as root
if [ "$EUID" -ne 0 ]; then
echo -e "${RED}Please run as root: sudo bash setup.sh${NC}"
exit 1
fi
echo -e "${YELLOW}[1/6] Installing Docker...${NC}"
if ! command -v docker &> /dev/null; then
curl -fsSL https://get.docker.com | sh
systemctl enable docker
systemctl start docker
echo -e "${GREEN}Docker installed!${NC}"
else
echo -e "${GREEN}Docker already installed.${NC}"
fi
echo -e "${YELLOW}[2/6] Installing dependencies...${NC}"
apt-get update -qq
apt-get install -y -qq git curl wget jq > /dev/null 2>&1
echo -e "${GREEN}Dependencies installed!${NC}"
echo -e "${YELLOW}[3/6] Cloning OpenClaw bot...${NC}"
BOT_DIR="/opt/openclaw"
if [ -d "$BOT_DIR" ]; then
rm -rf $BOT_DIR
fi
git clone https://huggingface.co/spaces/abbasyk60/ai-telegram-bot $BOT_DIR
cd $BOT_DIR
echo -e "${GREEN}Bot cloned!${NC}"
echo -e "${YELLOW}[4/6] Setting up environment variables...${NC}"
ENV_FILE="$BOT_DIR/.env"
# Prompt for API keys
echo ""
echo -e "${YELLOW}Enter your API keys:${NC}"
echo ""
read -p "OPENROUTER_API_KEY: " OR_KEY
read -p "TELEGRAM_BOT_TOKEN: " TG_TOKEN
read -p "CLOUDFLARE_PROXY_URL (press Enter to skip): " CF_URL
cat > $ENV_FILE << EOF
OPENROUTER_API_KEY=$OR_KEY
TELEGRAM_BOT_TOKEN=$TG_TOKEN
CLOUDFLARE_PROXY_URL=$CF_URL
BASE_URL=http://localhost:7860
EOF
echo -e "${GREEN}Environment configured!${NC}"
echo -e "${YELLOW}[5/6] Building Docker image...${NC}"
docker build -t openclaw-bot $BOT_DIR
echo -e "${GREEN}Docker image built!${NC}"
echo -e "${YELLOW}[6/6] Starting OpenClaw bot...${NC}"
docker run -d \
--name openclaw-bot \
--restart unless-stopped \
-p 7860:7860 \
--env-file $ENV_FILE \
-v /opt/openclaw-data:/app/data \
openclaw-bot
echo -e "${GREEN}"
echo "============================================"
echo " OpenClaw Bot is RUNNING!"
echo "============================================"
echo ""
echo " Status: http://localhost:7860"
echo " Logs: docker logs -f openclaw-bot"
echo ""
echo " Bot: @khoda609bot on Telegram"
echo ""
echo " Useful commands:"
echo " docker logs openclaw-bot # View logs"
echo " docker restart openclaw-bot # Restart"
echo " docker stop openclaw-bot # Stop"
echo " docker start openclaw-bot # Start"
echo ""
echo "============================================"
echo -e "${NC}"