DiscordBot / start.sh
QwertOs's picture
2
2fd3032 verified
Raw History Blame Contribute Delete
1.06 kB
#!/bin/bash
# Discord Bot 快速启动脚本 (Linux/Mac)
echo "========================================"
echo " Discord Bot 启动脚本"
echo "========================================"
echo ""
# 检查 .env 文件是否存在
if [ ! -f .env ]; then
echo "[警告] .env 文件不存在!"
echo ""
echo "请先复制 .env.example 为 .env 并填写配置:"
echo " cp .env.example .env"
echo ""
exit 1
fi
# 检查 Python 是否安装
if ! command -v python3 &> /dev/null; then
echo "[错误] 未找到 Python3!请先安装 Python 3.8+"
exit 1
fi
echo "[1/3] 检查依赖..."
pip3 install -r requirements.txt --quiet
if [ $? -ne 0 ]; then
echo "[错误] 依赖安装失败!"
exit 1
fi
echo "[完成] 依赖检查通过"
echo ""
echo "[2/3] 检查数据库连接..."
echo "请确保 PostgreSQL 正在运行并且配置正确"
echo ""
echo "[3/3] 启动 Bot..."
echo "========================================"
echo ""
python3 main.py
echo ""
echo "========================================"
echo "Bot 已停止"