mirror of
https://github.com/octoleo/telegram-bot-bash.git
synced 2024-11-22 15:35:09 +00:00
fixed some more bugs
This commit is contained in:
parent
fce86d0884
commit
6eca34758f
@ -144,7 +144,7 @@ forward() {
|
|||||||
startproc() {
|
startproc() {
|
||||||
mkdir -p "$copname"
|
mkdir -p "$copname"
|
||||||
mkfifo $copname/out
|
mkfifo $copname/out
|
||||||
tmux new-session -d -s $copname "./question 2>&1>$copname/out"
|
tmux new-session -d -s $copname "./question &>$copname/out"
|
||||||
local pid=$(ps aux | sed '/tmux/!d;/'$copname'/!d;/sed/d;s/'$USER'\s*//g;s/\s.*//g')
|
local pid=$(ps aux | sed '/tmux/!d;/'$copname'/!d;/sed/d;s/'$USER'\s*//g;s/\s.*//g')
|
||||||
echo $pid>$copname/pid
|
echo $pid>$copname/pid
|
||||||
while ps aux | grep -v grep | grep -q $pid;do
|
while ps aux | grep -v grep | grep -q $pid;do
|
||||||
@ -191,7 +191,7 @@ process_client() {
|
|||||||
# Location
|
# Location
|
||||||
LOCATION[LONGITUDE]=$(echo "$res" | egrep '\["result",0,"message","location","longitude"\]' | cut -f 2 | cut -d '"' -f 2)
|
LOCATION[LONGITUDE]=$(echo "$res" | egrep '\["result",0,"message","location","longitude"\]' | cut -f 2 | cut -d '"' -f 2)
|
||||||
LOCATION[LATITUDE]=$(echo "$res" | egrep '\["result",0,"message","location","latitude"\]' | cut -f 2 | cut -d '"' -f 2)
|
LOCATION[LATITUDE]=$(echo "$res" | egrep '\["result",0,"message","location","latitude"\]' | cut -f 2 | cut -d '"' -f 2)
|
||||||
NAME="$(basename ${URLS[*]})"
|
NAME="$(basename ${URLS[*]} &>/dev/null)"
|
||||||
|
|
||||||
# Tmux
|
# Tmux
|
||||||
copname="CO${USER[ID]}"
|
copname="CO${USER[ID]}"
|
||||||
@ -199,12 +199,12 @@ process_client() {
|
|||||||
copid="$(cat $copidname 2>/dev/null)"
|
copid="$(cat $copidname 2>/dev/null)"
|
||||||
|
|
||||||
if [ "$copid" = "" ]; then
|
if [ "$copid" = "" ]; then
|
||||||
[ "${URLS[*]}" != "" ] && {
|
[ ! -z "${URLS[*]}" ] && {
|
||||||
curl -s ${URLS[*]} -o $NAME
|
curl -s ${URLS[*]} -o $NAME
|
||||||
send_file "${USER[ID]}" "$NAME" "$CAPTION"
|
send_file "${USER[ID]}" "$NAME" "$CAPTION"
|
||||||
rm "$NAME"
|
rm "$NAME"
|
||||||
}
|
}
|
||||||
[ "${LOCATION[*]}" != "" ] && send_location "${USER[ID]}" "${LOCATION[LATITUDE]}" "${LOCATION[LONGITUDE]}"
|
[ ! -z "${LOCATION[*]}" ] && send_location "${USER[ID]}" "${LOCATION[LATITUDE]}" "${LOCATION[LONGITUDE]}"
|
||||||
case $MESSAGE in
|
case $MESSAGE in
|
||||||
'/question')
|
'/question')
|
||||||
startproc&
|
startproc&
|
||||||
|
Loading…
Reference in New Issue
Block a user