This repository was archived by the owner on Feb 4, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.sh
executable file
·54 lines (44 loc) · 1.43 KB
/
main.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
#!/bin/bash
#-----------------TEMPORARY: set language-----------------
export LC_ALL="en_US.utf8"
export LANGUAGE="en_US:en"
#----------------Set locale path--------------------------
TEXTDOMAIN=main.sh
TEXTDOMAINDIR="./translations/"
echo $"welcome"
#----------------Checking the envirmoment-----------------
command -v curl >/dev/null 2>&1 || { echo -e $"curlnotfound" >&2; exit 1; }
#----------------Initializing global variables------------
export API_V="5.65"
export api="https://api.vk.com/method/"
export tmp_dir="./tmp"
mkdir -p $tmp_dir
#----------------Including all source files requied-------
source ./api.sh
source ./auth.sh
source ./encoder.sh
source ./modules/vk_longpoll.sh
source ./modules/vk_friends.sh
source ./modules/vk_copystatus.sh
source ./modules/vk_bot.sh
#----------------Check if auth is needed------------------
check_auth
#----------------Get token--------------------------------
access_token=$(head -n 2 token.key | tail -1)
#----------------Run longpoll-----------------------------
longpoll &
longpoll_pid=$!
#----------------Main body--------------------------------
while true
do
$(dialog --nocancel --menu $"menu" 0 0 0 \
copy_status $"cpstatus" \
select_friend "Choose a friend"\
bot "Bot"\
break "Exit"\
--output-fd 1)
done
#---------------Kill background process-------------------
{ kill $longpoll_pid && wait $longpoll_pid; } 2>/dev/null
#---------------Final Cleanup-----------------------------
rm -rf tmp/