-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_bot.sh
More file actions
53 lines (45 loc) · 1.31 KB
/
Copy pathrun_bot.sh
File metadata and controls
53 lines (45 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/bash
# Startup script for API Bot on Linux/Mac
echo "================================================"
echo " API Resource Availability Bot - Starting"
echo "================================================"
echo ""
# Check if virtual environment exists
if [ ! -d "venv" ]; then
echo "[ERROR] Virtual environment not found!"
echo "Please run: python3 -m venv venv"
exit 1
fi
# Activate virtual environment
echo "[1/3] Activating virtual environment..."
source venv/bin/activate
if [ $? -ne 0 ]; then
echo "[ERROR] Failed to activate virtual environment"
exit 1
fi
# Check if .env exists
if [ ! -f ".env" ]; then
echo "[WARNING] .env file not found!"
echo "Please copy .env.example to .env and configure your bot token"
exit 1
fi
# Check dependencies
echo "[2/3] Checking dependencies..."
python -c "import telegram" 2>/dev/null
if [ $? -ne 0 ]; then
echo "[ERROR] Dependencies not installed!"
echo "Please run: pip install -r requirements.txt"
exit 1
fi
# Start the bot
echo "[3/3] Starting bot..."
echo ""
echo "Bot is running! Press Ctrl+C to stop."
echo "================================================"
echo ""
python bot.py
# If bot exits
echo ""
echo "================================================"
echo " Bot stopped"
echo "================================================"