forked from code-pms/MyGpack
-
Notifications
You must be signed in to change notification settings - Fork 24
/
heroku
111 lines (94 loc) · 3.1 KB
/
heroku
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#!/bin/bash
# Copyright (C) 2021 MyGpack
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# error precaution.
set -e
WORK_DIR="userbot"
mkdir -p $WORK_DIR
disp () {
echo "-----> $*"
}
indent () {
sed -u 's/^/ /'
}
_done () {
echo -e "Done\n" | indent
}
_displaylogo () {
echo '
===========================================
▄████ ██▓███ ▄▄▄ ▄████▄ ██ ▄█▀
██▒ ▀█▒▓██░ ██▒▒████▄ ▒██▀ ▀█ ██▄█▒
▒██░▄▄▄░▓██░ ██▓▒▒██ ▀█▄ ▒▓█ ▄ ▓███▄░
░▓█ ██▓▒██▄█▓▒ ▒░██▄▄▄▄██ ▒▓▓▄ ▄██▒▓██ █▄
░▒▓███▀▒▒██▒ ░ ░ ▓█ ▓██▒▒ ▓███▀ ░▒██▒ █▄
░▒ ▒ ▒▓▒░ ░ ░ ▒▒ ▓▒█░░ ░▒ ▒ ░▒ ▒▒ ▓▒
░ ░ ░▒ ░ ▒ ▒▒ ░ ░ ▒ ░ ░▒ ▒░
░ ░ ░ ░░ ░ ▒ ░ ░ ░░ ░
░ ░ ░░ ░ ░ ░
░
===========================================
| VERSION v0.1.0 |
| By: @midnightmadwalk and code-rgb |
| (C) 2021 - USERGE-X |
===========================================
'
}
get_branch () {
local branch
if [[ $PREF_BRANCH ]]
then
branch=$(echo $PREF_BRANCH | xargs)
else
branch=alpha
fi
echo "/archive/refs/heads/$branch.zip"
}
get_ziplink () {
local regex
regex='(https?)://github.com/.+/.+'
if [[ $UPSTREAM_REPO =~ $regex ]]
then
echo "${UPSTREAM_REPO}$(get_branch)"
else
echo "$(echo "aHR0cHM6Ly9naXRodWIuY29tL2NvZGUtcmdiL1VTRVJHRS1Y" | base64 -d)$(get_branch)"
fi
}
_setup_repo () {
local zippath
zippath="$WORK_DIR/temp.zip"
disp "Fetching Update from Upstream Repo"
wget -qq $(get_ziplink) -O "$zippath"
_done
disp "Unpacking Data"
unzip -qq "$zippath" -d "$WORK_DIR"
_done
disp "Cleaning"
rm -rf "$zippath"
_done
}
_startbot () {
local bot_dir
bot_dir=$(cd $WORK_DIR && ls) && mv "$WORK_DIR/$bot_dir" "USERGE-X"
rm -rf $WORK_DIR
cd "USERGE-X"
git init > /dev/null 2>&1
echo -e ">><< --- >><< Starting [X] >><< --- >><<\n" | indent
bash run
}
begin_x () {
_displaylogo
sleep 5
_setup_repo
_startbot
}
begin_x