2020-06-07 11:30:59 +00:00
|
|
|
#!/bin/bash
|
|
|
|
# file: interactive.sh
|
|
|
|
# template for an interactive chat
|
2020-08-01 09:37:32 +00:00
|
|
|
# test: start_proc "${CHAT[ID]}" "./scripts/interactive.sh.clean"
|
2020-06-07 11:30:59 +00:00
|
|
|
#
|
|
|
|
# This file is public domain in the USA and all free countries.
|
|
|
|
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
|
|
|
#
|
2020-11-30 17:38:19 +00:00
|
|
|
#### $$VERSION$$ v1.2-0-gc50499c
|
2020-06-07 11:30:59 +00:00
|
|
|
|
|
|
|
######
|
|
|
|
# parameters
|
2020-08-01 09:37:32 +00:00
|
|
|
# $1 $2 args as given to start_proc chat script arg1 arg2
|
2020-06-07 11:30:59 +00:00
|
|
|
# $3 path to named pipe
|
|
|
|
|
|
|
|
# adjust your language setting here
|
|
|
|
# https://github.com/topkecleon/telegram-bot-bash#setting-up-your-environment
|
|
|
|
export 'LC_ALL=C.UTF-8'
|
|
|
|
export 'LANG=C.UTF-8'
|
|
|
|
export 'LANGUAGE=C.UTF-8'
|
|
|
|
|
|
|
|
unset IFS
|
|
|
|
# set -f # if you are paranoid use set -f to disable globbing
|
|
|
|
|
|
|
|
#######################
|
|
|
|
# place your commands here
|
|
|
|
#
|
|
|
|
# IMPORTTANT: to read user input from $INPUT
|
|
|
|
INPUT="${3:-/dev/stdin}"
|
|
|
|
#
|
|
|
|
# read -r variable <"${INPUT}"
|
|
|
|
|
|
|
|
# example wait form user input and echo it
|
|
|
|
echo "Enter a message:"
|
|
|
|
|
|
|
|
read -r test <"${INPUT}"
|
|
|
|
echo -e "Your Message: ${test}\nbye!"
|
|
|
|
|
|
|
|
|
|
|
|
# your commands ends here
|
|
|
|
######################
|
|
|
|
|