Files
nanocode/weixin-nanobot-bridge/start-weixin.sh
T
Ubuntu 32b43f85bd a
2026-07-03 16:58:28 +08:00

32 lines
717 B
Bash
Executable File

#!/bin/bash
# 一键启动微信桥接
set -e
cd "$(dirname "$0")"
# 设置公网地址
export SERVER_IP=$(curl -s ifconfig.me)
export NANOBOT_BRIDGE_URL="http://${SERVER_IP}:5000/chat"
echo "🚀 启动 WeChat-Nanobot Bridge"
echo " 服务器IP: $SERVER_IP"
echo " 桥接地址: $NANOBOT_BRIDGE_URL"
echo ""
# 检查 bridge 服务
if ! curl -s "$NANOBOT_BRIDGE_URL/../health" > /dev/null 2>&1; then
echo "⚠️ Bridge 服务未运行,正在启动..."
nohup python3 src/server.py > logs/server.log 2>&1 &
sleep 3
fi
echo "✅ Bridge 服务正常"
echo ""
echo "📱 准备登录微信..."
echo " 请扫描屏幕上显示的二维码"
echo ""
# 启动微信适配器
node weixin-bridge.js