forked from Dragon-Userbot/Dragon-Userbot
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtermux-install.sh
78 lines (63 loc) · 1.87 KB
/
termux-install.sh
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
if ! command -v termux-setup-storage; then
echo This script can be executed only on Termux
exit 1
fi
termux-wake-lock
apt update -y
apt install python3 git clang ffmpeg wget libjpeg-turbo libcrypt ndk-sysroot zlib -y || exit 2
python3 -m pip install -U pip
LDFLAGS="-L${PREFIX}/lib/" CFLAGS="-I${PREFIX}/include/" pip3 install --upgrade wheel pillow
if [[ -d "Dragon-Userbot" ]]; then
cd Dragon-Userbot
elif [[ -f ".env.dist" ]] && [[ -f "main.py" ]] && [[ -d "modules" ]]; then
:
else
git clone https://github.com/Dragon-Userbot/Dragon-Userbot || exit 2
cd Dragon-Userbot || exit 2
fi
if [[ -f ".env" ]] && [[ -f "my_account.session" ]]; then
echo "It seems that Dragon-Userbot is already installed. Exiting..."
exit
fi
python3 -m pip install -U -r requirements.txt || exit 2
echo
echo "Enter API_ID and API_HASH"
echo "You can get it here -> https://my.telegram.org/apps"
echo "Leave empty to use defaults"
read -r -p "API_ID > " api_id
if [[ $api_id = "" ]]; then
api_id="2040"
api_hash="b18441a1ff607e10a989891a5462e627"
else
read -r -p "API_HASH > " api_hash
fi
echo "Choose database type:"
echo "[1] MongoDB (your url)"
echo "[2] Sqlite"
read -r -p "> " db_type
if [[ $db_type = 1 ]]; then
echo "Please enter db_url"
echo "You can get it here -> https://telegra.ph/How-to-get-Mongodb-URL-and-login-in-telegram-08-01"
read -r -p "> " db_url
db_name=Dragon_Userbot
db_type=mongodb
else
db_name=db.sqlite3
db_type=sqlite3
fi
cat > .env << EOL
API_ID=${api_id}
API_HASH=${api_hash}
# sqlite/sqlite3 or mongo/mongodb
DATABASE_TYPE=${db_type}
# file name for sqlite3, database name for mongodb
DATABASE_NAME=${db_name}
# only for mongodb
DATABASE_URL=${db_url}
EOL
python3 install.py 3 || exit 3
echo
echo "============================"
echo "Great! Dragon-Userbot installed successfully!"
echo "Start with: \"python3 main.py\""
echo "============================"