mirror of
https://github.com/octoleo/telegram-bot-bash.git
synced 2024-11-21 23:25:08 +00:00
doc: no jobs with webhook
This commit is contained in:
parent
c57e9273fb
commit
f4323e48b5
@ -34,7 +34,7 @@ will append `{"test":"me"}` to the file `data-bot-bash/webhook-fifo-<botname>`.
|
||||
Now your Apache is ready to forward data to Bashbot.
|
||||
|
||||
|
||||
#### Enable update processing for Bashbot
|
||||
#### Webhook update processing for Bashbot
|
||||
|
||||
To enable update processing delete the file `data-bot-bash/webhook-fifo-<botname>` after your webhook is working manually.
|
||||
All webhook calls are now forwarded to `bin/process_update.sh` for processing.
|
||||
@ -42,9 +42,14 @@ All webhook calls are now forwarded to `bin/process_update.sh` for processing.
|
||||
Every incoming Telegram update load Bashbot once for processing one command. Even it seems overkill to load
|
||||
Bashbot on every incoming update, it's more responsive and create less server load than polling Telegram
|
||||
|
||||
If your bot uses `addons` or `BASHBOT_EVENTs` you can't use webhooks as described here.
|
||||
|
||||
*Note:* webhook work without running `bashbot.sh start`.
|
||||
This webhook works without running `bashbot.sh` and thus has the following limitations:
|
||||
- no startup actions
|
||||
- no backgroundi* and interactive jobs
|
||||
- `addons` and `BASHBOT_EVENTs' are not working
|
||||
|
||||
\* workaround for background jobs is to start them in the channel and execute `./bashbot.sh restartback` afterwards.
|
||||
|
||||
|
||||
|
||||
#### Enable webhook on Telegram side
|
||||
@ -82,5 +87,5 @@ and read updates from the named pipe `data-bot-bash/webhook-fifo-<botname>`, sim
|
||||
But the default webhook method is so convincing and responsive that a special high traffic mode is not necessary.
|
||||
|
||||
|
||||
#### $$VERSION$$ v1.45-dev-39-g8b18f25
|
||||
#### $$VERSION$$ v1.45-dev-46-gc57e927
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
||||
#
|
||||
# shellcheck disable=SC1117,SC2059
|
||||
#### $$VERSION$$ v1.40-0-gf9dab50
|
||||
#### $$VERSION$$ v1.45-dev-46-gc57e927
|
||||
|
||||
# will be automatically sourced from bashbot
|
||||
|
||||
@ -46,6 +46,10 @@ start_back() {
|
||||
printf '%s\n' "$1:$3:$2" >"${cmdfile}"
|
||||
restart_back "$@"
|
||||
}
|
||||
# $1 chatid
|
||||
# $2 program
|
||||
# $3 jobname
|
||||
# $4 $5 parameters
|
||||
restart_back() {
|
||||
local fifo; fifo="${DATADIR:-.}/$(procname "$1" "back-$3-")"
|
||||
log_update "Start background job CHAT=$1 JOB=${fifo##*/} CMD=${2##*/} $4 $5"
|
||||
@ -62,9 +66,9 @@ start_proc() {
|
||||
[ -z "$2" ] && return
|
||||
[ -x "${2%% *}" ] || return 1
|
||||
local fifo; fifo="${DATADIR:-.}/$(procname "$1")"
|
||||
log_update "Start interactive script CHAT=$1 JOB=${fifo##*/} CMD=$2 $3 $4"
|
||||
check_proc "$1" && kill_proc "$1"
|
||||
mkfifo "${fifo}"
|
||||
log_update "Start interactive script CHAT=$1 JOB=${fifo##*/} CMD=$2 $3 $4"
|
||||
nohup bash -c "{ $2 \"$4\" \"$5\" \"${fifo}\" | \"${SCRIPT}\" outproc \"$1\" \"${fifo}\"
|
||||
rm \"${fifo}\"; [ -s \"${fifo}.log\" ] || rm -f \"${fifo}.log\"; }" &>>"${fifo}.log" &
|
||||
}
|
||||
@ -99,9 +103,11 @@ kill_proc() {
|
||||
fifo="$(procname "$1" "$2")"
|
||||
prid="$(proclist "${fifo}")"
|
||||
fifo="${DATADIR:-.}/${fifo}"
|
||||
log_update "Stop interactive / background CHAT=$1 JOB=${fifo##*/}"
|
||||
# shellcheck disable=SC2086
|
||||
[ -n "${prid}" ] && kill ${prid}
|
||||
if [ -n "${prid}" ]; then
|
||||
log_update "Stop interactive / background CHAT=$1 JOB=${fifo##*/}"
|
||||
kill ${prid}
|
||||
fi
|
||||
[ -s "${fifo}.log" ] || rm -f "${fifo}.log"
|
||||
[ -p "${fifo}" ] && rm -f "${fifo}";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user