Updated nested tmux and fixed username in chats

With the: ''TMUX= tmux new-session -d -s ....'' addition,  now interactive chats work when you are running the bot inside a tmux session.

Before, USER[USERNAME] was not getting the username of the user in groups, now it is solved.
This commit is contained in:
Ignacio Iglesias 2016-03-26 23:31:47 +01:00
parent 64f3cb5fc7
commit 6ad35f34d7
1 changed files with 2 additions and 2 deletions

View File

@ -151,7 +151,7 @@ startproc() {
rm -r $copname
mkfifo $copname
tmux kill-session -t $copname
tmux new-session -d -s $copname "./question &>$copname"
TMUX= tmux new-session -d -s $copname "./question &>$copname"
while tmux ls | grep -q $copname;do
read -t 10 line
[ "$line" != "" ] && send_message "${USER[ID]}" "$line"
@ -169,7 +169,7 @@ process_client() {
# User
USER[FIRST_NAME]=$(echo "$res" | egrep '\["result",0,"message","chat","first_name"\]' | cut -f 2 | cut -d '"' -f 2)
USER[LAST_NAME]=$(echo "$res" | egrep '\["result",0,"message","chat","last_name"\]' | cut -f 2 | cut -d '"' -f 2)
USER[USERNAME]=$(echo "$res" | egrep '\["result",0,"message","chat","username"\]' | cut -f 2 | cut -d '"' -f 2)
USER[USERNAME]=$(echo "$res" | sed 's/^.*\(username.*\)/\1/g' | cut -d '"' -f3)
# Audio
URLS[AUDIO]=$(get_file $(echo "$res" | egrep '\["result",0,"message","audio","file_id"\]' | cut -f 2 | cut -d '"' -f 2))