forked from ShaerWare/AI_Secretary_System
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart_telegram_bot.sh
More file actions
executable file
·42 lines (34 loc) · 1.26 KB
/
start_telegram_bot.sh
File metadata and controls
executable file
·42 lines (34 loc) · 1.26 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
#!/bin/bash
# Start Telegram Bot for AI Secretary
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR"
echo "🤖 Starting Telegram Bot..."
# Check if config exists
if [ ! -f telegram_config.json ]; then
echo "⚠️ telegram_config.json not found."
echo " Configure the bot via admin panel: http://localhost:8002/admin/#/telegram"
exit 1
fi
# Check if enabled
ENABLED=$(python3 -c "import json; print(json.load(open('telegram_config.json')).get('enabled', False))" 2>/dev/null || echo "False")
if [ "$ENABLED" != "True" ]; then
echo "⚠️ Telegram bot is disabled in config."
echo " Enable it via admin panel: http://localhost:8002/admin/#/telegram"
exit 1
fi
# Check if token exists
HAS_TOKEN=$(python3 -c "import json; print(bool(json.load(open('telegram_config.json')).get('bot_token', '')))" 2>/dev/null || echo "False")
if [ "$HAS_TOKEN" != "True" ]; then
echo "❌ Bot token not configured!"
echo " Get token from @BotFather and add it in admin panel"
exit 1
fi
# Check dependencies
if ! python3 -c "import telegram" 2>/dev/null; then
echo "📦 Installing python-telegram-bot..."
pip install python-telegram-bot aiohttp
fi
# Start bot
echo "✅ Starting bot..."
python3 telegram_bot_service.py