From af887fd563d26d9e0609b741ad4da3c1b25d2285 Mon Sep 17 00:00:00 2001 From: BitMaster Admin Date: Thu, 19 Jun 2025 12:55:10 +0000 Subject: [PATCH] Update install.sh --- install.sh | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/install.sh b/install.sh index ffa4123..fe56712 100644 --- a/install.sh +++ b/install.sh @@ -81,7 +81,7 @@ function check_and_install_docker() { apt install -y docker-compose-plugin else mkdir -p ~/.docker/cli-plugins - curl -SL https://github.com/docker/compose/releases/download/v2.27.1/docker-compose-linux-x86_64 \ + curl -SL https://github.com/docker/compose/releases/download/v2.27.1/docker-compose-linux-x86_64 \\ -o ~/.docker/cli-plugins/docker-compose chmod +x ~/.docker/cli-plugins/docker-compose export PATH="$HOME/.docker/cli-plugins:$PATH" @@ -129,8 +129,20 @@ function clone_and_build() { echo -e "${YELLOW}📨 Enter your Telegram bot token:${NC}" read -rp "🔑 TELEGRAM_TOKEN: " token - echo -e "${YELLOW}👥 Enter your Telegram chat ID:${NC}" + echo -e "${YELLOW}👥 Enter your Telegram chat ID (or leave blank to auto-detect):${NC}" read -rp "🆔 TELEGRAM_CHAT_ID: " chat_id + + if [ -z "$chat_id" ]; then + echo -e "${YELLOW}🔍 Trying to auto-detect chat_id from getUpdates...${NC}" + chat_id=$(curl -s "https://api.telegram.org/bot$token/getUpdates" | grep -oE '"id":-100[0-9]+' | head -n1 | cut -d: -f2) + if [ -n "$chat_id" ]; then + echo -e "${GREEN}✅ Detected chat_id: $chat_id${NC}" + else + echo -e "${RED}❌ Failed to detect chat_id. Please enter it manually.${NC}" + read -rp "🆔 TELEGRAM_CHAT_ID: " chat_id + fi + fi + sed -i "s|^TELEGRAM_TOKEN = .*|TELEGRAM_TOKEN = \"$token\"|" bot.py sed -i "s|^CHAT_ID = .*|CHAT_ID = \"$chat_id\"|" bot.py echo -e "${GREEN}✅ Credentials updated in bot.py${NC}"