-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.html
More file actions
218 lines (177 loc) · 5.67 KB
/
index.html
File metadata and controls
218 lines (177 loc) · 5.67 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
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
#!/bin/bash
# Check if apt package manager is available
if ! command -v apt &> /dev/null; then
echo -e "\e[31mThis script is intended for use Only
on Linux systems with the apt package manager.\e[0m"
exit 1
fi
export DEBIAN_FRONTEND=noninteractive
# Function to run commands with sudo if not root
run_with_sudo() {
if [ "$EUID" -ne 0 ]; then
sudo "$@"
else
"$@"
fi
}
# Prompt for BOT name
echo -e "\e[36mGreetings Master Mulandi🫠.Enter a name for your BOT (e.g., levanter):\e[0m"
read -r BOT_NAME
BOT_NAME=${BOT_NAME:-levanter}
# Handle existing directory with the same name
if [ -d "$BOT_NAME" ]; then
RANDOM_SUFFIX=$((1 + RANDOM % 1000))
BOT_NAME="${BOT_NAME}${RANDOM_SUFFIX}"
echo -e "\e[33mFolder with the same name already exists. Renaming to $BOT_NAME.\e[0m"
fi
# Prompt for SESSION_ID
echo -e "\e[36mDo you have a SESSION_ID scanned today? (y/n):\e[0m"
read -r HAS_SESSION_ID
SESSION_ID=""
if [[ "$HAS_SESSION_ID" == "y" ]]; then
echo -e "\e[36mNice😉,Now Enter Your SESSION_ID:\e[0m"
read -r SESSION_ID
fi
# Function to install Node.js
install_nodejs() {
echo -e "\e[33mInstalling Node.js version 20...\e[0m"
curl -fsSL https://deb.nodesource.com/setup_20.x -o nodesource_setup.sh
if ! bash nodesource_setup.sh; then
echo -e "\e[31mFailed to run nodesource setup script.\e[0m"
exit 1
fi
if ! run_with_sudo apt-get install -y nodejs; then
echo -e "\e[31mFailed to install Node.js.\e[0m"
exit 1
fi
rm nodesource_setup.sh
}
# Function to uninstall Node.js
uninstall_nodejs() {
echo -e "\e[33mRemoving existing Node.js installation...\e[0m"
if ! run_with_sudo apt-get remove -y nodejs; then
echo -e "\e[31mFailed to remove Node.js.\e[0m"
exit 1
fi
if ! run_with_sudo apt-get autoremove -y; then
echo -e "\e[31mFailed to autoremove packages.\e[0m"
exit 1
fi
}
# Update system packages
echo -e "\e[33mUpdating system packages...\e[0m"
if ! run_with_sudo apt update -y; then
echo -e "\e[31mFailed to update system packages.\e[0m"
exit 1
fi
# Install required packages
for pkg in git ffmpeg curl; do
if ! command -v "$pkg" &> /dev/null; then
if ! run_with_sudo apt install -y "$pkg"; then
echo -e "\e[31mFailed to install $pkg.\e[0m"
exit 1
fi
fi
done
# Check for Node.js version and reinstall if necessary
if command -v node &> /dev/null; then
CURRENT_NODE_VERSION=$(node -v | cut -d. -f1)
if [[ "$CURRENT_NODE_VERSION" != "v20" ]]; then
uninstall_nodejs
install_nodejs
else
echo -e "\e[32mNode.js version 20 is already installed.\e[0m"
fi
else
install_nodejs
fi
# Check and install Yarn
YARN_REQUIRED_VERSION="1" # Set required Yarn major version here
if command -v yarn &> /dev/null; then
CURRENT_YARN_VERSION=$(yarn -v | cut -d. -f1)
if [[ "$CURRENT_YARN_VERSION" != "$YARN_REQUIRED_VERSION" ]]; then
echo -e "\e[33mRemoving existing Yarn installation...\e[0m"
if ! run_with_sudo apt-get remove -y yarn; then
echo -e "\e[31mFailed to remove Yarn.\e[0m"
exit 1
fi
if ! run_with_sudo apt-get autoremove -y; then
echo -e "\e[31mFailed to autoremove packages.\e[0m"
exit 1
fi
echo -e "\e[33mInstalling Yarn...\e[0m"
if ! run_with_sudo npm install -g yarn; then
echo -e "\e[31mFailed to install Yarn.\e[0m"
exit 1
fi
else
echo -e "\e[32mYarn is already installed.\e[0m"
fi
else
echo -e "\e[33mInstalling Yarn...\e[0m"
if ! run_with_sudo npm install -g yarn; then
echo -e "\e[31mFailed to install Yarn.\e[0m"
exit 1
fi
fi
# Check and install PM2
if ! command -v pm2 &> /dev/null; then
echo -e "\e[33mInstalling PM2...\e[0m"
if ! yarn global add pm2; then
echo -e "\e[31mFailed to install PM2.\e[0m"
exit 1
fi
else
echo -e "\e[32mPM2 is already installed.\e[0m"
fi
# Clone the repository
echo -e "\e[33mCloning Levanter repository...\e[0m"
if ! git clone https://github.com/lyfe00011/levanter.git "$BOT_NAME"; then
echo -e "\e[31mFailed to clone repository.\e[0m"
exit 1
fi
cd "$BOT_NAME"
# Install dependencies
echo -e "\e[33mInstalling dependencies with Yarn...\e[0m"
if ! yarn install --network-concurrency 3; then
echo -e "\e[31mFailed to install dependencies.\e[0m"
exit 1
fi
# Create config.env file
echo -e "\e[33mCreating config.env file...\e[0m"
cat > config.env <<EOL
PREFIX = null
STICKER_PACKNAME = ᵃᶜᵉ±𝙽𝚢𝚡
ALWAYS_ONLINE = true
RMBG_KEY = null
LANGUAGE = en
WARN_LIMIT = 3
FORCE_LOGOUT = false
BRAINSHOP = 159501,6pq8dPiYt7PdqHz3
MAX_UPLOAD = 60
REJECT_CALL = false
SUDO = null,254768827492
TZ = Africa/Nairobi
ANTI_DELETE = p
VV= P
VPS = true
AUTO_STATUS_VIEW = no-dl
SEND_READ = false
AJOIN = true
STATUS_VIEW_EMOJI = false
ANTI_DELETE = p
BING_COOKIE = false
VV = p
GEMINI_API_KEY = AIzaSyBS8IDHKR-49k9kB7vMA4moHAZAUR3hA0g
MENTION = { "contextInfo": { "forwardingScore": 5, "isForwarded": false }, "linkPreview": { "head": "𝙷𝚎𝚕𝚕𝚘 𝚝𝚑𝚎𝚛𝚎🍃", "body": " Tap to view👐", "mediaType": 2, "thumbnail": "https://files.catbox.moe/o9bfas.jpeg", "sourceUrl": "https://by-ace.vercel.app/" } , "waveform": [ 20,5,0,80,80,30,20,50 ] }
EOL
echo "NAME=$BOT_NAME" >> config.env
if [ -n "$SESSION_ID" ]; then
echo "SESSION_ID=$SESSION_ID" >> config.env
fi
# Start the bot
echo -e "\e[33mStarting the bot...\e[0m"
if ! pm2 start index.js --name "$BOT_NAME" --attach; then
echo -e "\e[31mFailed to start the bot.\e[0m"
exit 1
fi