2019-04-23 19:52:57 +00:00
|
|
|
#!/bin/bash
|
|
|
|
# files: mycommands.sh.dist
|
|
|
|
# copy to mycommands.sh and add all your commands and functions here ...
|
|
|
|
#
|
2019-04-25 12:45:16 +00:00
|
|
|
#### $$VERSION$$ v0.70-dev2-27-g2da31c1
|
2019-04-23 19:52:57 +00:00
|
|
|
#
|
|
|
|
# shellcheck disable=SC2154
|
|
|
|
# shellcheck disable=SC2034
|
|
|
|
|
2019-04-24 11:34:44 +00:00
|
|
|
|
2019-04-24 11:40:59 +00:00
|
|
|
# uncomment the following lines to overwrite info and help messages
|
|
|
|
# bashbot_info='This is bashbot, the Telegram bot written entirely in bash.
|
2019-04-24 11:34:44 +00:00
|
|
|
#'
|
|
|
|
# bashbot_help='*Available commands*:
|
|
|
|
#'
|
|
|
|
|
|
|
|
|
2019-04-23 19:52:57 +00:00
|
|
|
# your additional bahsbot commands
|
|
|
|
mycommands() {
|
|
|
|
|
|
|
|
case "$MESSAGE" in
|
|
|
|
'/echo'*) # example echo command
|
|
|
|
send_normal_message "${CHAT[ID]}" "$MESSAGE"
|
|
|
|
;;
|
|
|
|
'/question') # start interactive questions
|
|
|
|
checkproc
|
|
|
|
if [ "$res" -gt 0 ] ; then
|
|
|
|
startproc "example/question"
|
|
|
|
else
|
|
|
|
send_normal_message "${CHAT[ID]}" "$MESSAGE already running ..."
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
|
|
|
|
'/run-notify') # start notify background job
|
|
|
|
myback="notify"; checkback "$myback"
|
|
|
|
if [ "$res" -gt 0 ] ; then
|
|
|
|
background "example/notify 60" "$myback" # notify every 60 seconds
|
|
|
|
else
|
|
|
|
send_normal_message "${CHAT[ID]}" "Background command $myback already running ..."
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
'/stop-notify') # kill notify background job
|
|
|
|
myback="notify"; checkback "$myback"
|
|
|
|
if [ "$res" -eq 0 ] ; then
|
|
|
|
killback "$myback"
|
|
|
|
send_normal_message "${CHAT[ID]}" "Background command $myback canceled."
|
|
|
|
else
|
|
|
|
send_normal_message "${CHAT[ID]}" "No background command $myback is currently running.."
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
|
|
|
# place your processing functions here
|