implemented callback detection and response

This commit is contained in:
celso 2023-03-22 19:09:33 -03:00
parent c697b07635
commit 6d0a565dc4
1 changed files with 4 additions and 2 deletions

6
bot.sh
View File

@ -19,12 +19,14 @@ exec 2>"${bot_tmpdir}/error.log"
. ./bashbot-lib/viewer.sh . ./bashbot-lib/viewer.sh
while [ "${1}" == "start" ]; do while [ "${1}" == "start" ]; do
grep "\S" <<< $(getupd) >/dev/null || continue getupd >/dev/null || continue
declare -A curmsg declare -A curmsg
getmsg_content curmsg updates.txt getmsg_content curmsg updates.txt
view_content curmsg view_content curmsg
for i in $(awk '{print $1}' ./allowed_ids.txt); do for i in $(awk '{print $1}' ./allowed_ids.txt); do
[ "${curmsg[user_id]}" == "${i}" ] && [ "${curmsg[text]}" == "/start" ] && { [ "${curmsg[user_id]}" == "${i}" ] && {
[ "${curmsg[callback]}" == "recheck" ] || [ "${curmsg[text]}" == "/start" ]
} && {
sendmsg "${curmsg[chat_id]}" $(./getip.sh "${bot_tmpdir}") sendmsg "${curmsg[chat_id]}" $(./getip.sh "${bot_tmpdir}")
unset curmsg unset curmsg
declare -A curmsg declare -A curmsg