Update install.sh

This commit is contained in:
2025-06-19 12:55:10 +00:00
parent 1f81999bd2
commit af887fd563

View File

@@ -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}"