-
Notifications
You must be signed in to change notification settings - Fork 2
/
bot.sh
74 lines (64 loc) · 1.9 KB
/
bot.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
#!/bin/bash
#Clear & Clean terminal before starting
clear
rm -f bot.log
# Source core utils
source .token.sh
source util.sh
# Source functions
source bot/all_replace.sh
source bot/calc.sh
source bot/fun/choice.sh
source bot/github.sh
source bot/info.sh
source bot/fun/iq.sh
source bot/log_dump.sh
source bot/extra/neofetch.sh
source bot/paste.sh
source bot/extra/pfp.sh
source bot/extra/purge.sh
source bot/fun/replace.sh
source bot/help.sh
source bot/reset_log.sh
source bot/extra/round.sh
source bot/start.sh
source bot/fun/shuffle.sh
source bot/weath.sh
source bot/bot_util.sh
source bot/extra/shell.sh
log -i tgbot "STARTING BOT"
## While loop
while true; do
# Refresh stuff
update
[ "$RET_MSG_TEXT" ] && log -v tgbot "Message received: $RET_MSG_TEXT" | tee -a log
[ "$RET_MSG_TEXT" ] && log -v tgbot " -> Chat title: $RET_CHAT_TITLE" | tee -a log &
[ "$RET_MSG_TEXT" ] && log -v tgbot " -> Chat id: $RET_CHAT_ID" | tee -a log &
RET_LOWERED_MSG_TEXT=$(tr '[:upper:]' '[:lower:]' <<<"$RET_MSG_TEXT")
case $RET_LOWERED_MSG_TEXT in
'/start'*) start | tee -a log ;;
'/help'*) help_msg | tee -a log ;;
'.all_replace'*) all_replace | tee -a log ;;
'.calc'*) calc | tee -a log ;;
'.choice'*) choice | tee -a log ;;
'/iq'*) iq | tee -a log ;;
'/info'*) info | tee -a log ;;
'/issues'*) send_open_issues ;;
'/neofetch'*) neo_fetch | tee -a log ;;
'/pfp'*) pfp | tee -a log ;;
'/paste'*) paste | tee -a log ;;
'.replace'*) replace | tee -a log ;;
'.round'*) round_msg | tee -a log;;
'/weath'*) weath | tee -a log ;;
'.log'*) log_dump ;;
'/members'*) send_members ;;
'/prs'*) send_open_pull_requests ;;
'.reset_log'*) reset_log ;;
'.shuffle'*) shuffle ;;
'.purge'*) purge ;;
'.restart'*) bot_util::restart ;;
'.update'*) bot_util::update ;;
'.shell'*) shell ;;
esac
unset RET_MSG_TEXT RET_REPLIED_MSG_ID
done