mirror of
https://github.com/danog/telegram-bot-bash.git
synced 2024-11-30 04:29:19 +01:00
Reduced interactive command timeout, added command to print last newline and made startproc call command in args
This commit is contained in:
parent
495c23def4
commit
c96cc8a4a7
@ -130,7 +130,7 @@ Allowed values: typing for text messages, upload_photo for photos, record_video
|
||||
send_action "${USER[ID]}" "action"
|
||||
```
|
||||
|
||||
To create interactive chats, write (or edit the question script) a normal bash (or C or python) script, chmod +x it and then substitute ./question @ line 49 with the command you usually use to start the script.
|
||||
To create interactive chats, write (or edit the question script) a normal bash (or C or python) script, chmod +x it and then change the argument of the startproc function to match the command you usually use to start the script.
|
||||
The text that the script will output will be sent in real time to the user, and all user input will be sent to the script (as long as it's running or until the user kills it with /cancel).
|
||||
To open up a keyboard in an interactive script, print out the keyboard layout in the following way:
|
||||
```
|
||||
|
@ -152,7 +152,7 @@ startproc() {
|
||||
tmux kill-session -t $copname)2>/dev/null
|
||||
|
||||
mkfifo $copname
|
||||
TMUX= tmux new-session -d -s $copname "./question &>$copname; sleep 10; rm -r $copname"
|
||||
TMUX= tmux new-session -d -s $copname "$* &>$copname; echo >$copname; sleep 5; rm -r $copname"
|
||||
while [ -p "$copname" ];do
|
||||
read -t 10 line
|
||||
[ "$line" != "" ] && send_message "${USER[ID]}" "$line"
|
||||
@ -210,7 +210,7 @@ process_client() {
|
||||
[ ! -z ${LOCATION[*]} ] && send_location "${USER[ID]}" "${LOCATION[LATITUDE]}" "${LOCATION[LONGITUDE]}"
|
||||
case $MESSAGE in
|
||||
'/question')
|
||||
startproc&
|
||||
startproc "./question"&
|
||||
;;
|
||||
'/info')
|
||||
send_message "${USER[ID]}" "This is bashbot, the Telegram bot written entirely in bash."
|
||||
|
Loading…
Reference in New Issue
Block a user