mirror of
https://github.com/octoleo/telegram-bot-bash.git
synced 2025-01-22 21:28:24 +00:00
factor out background, update doc
This commit is contained in:
parent
92ad9e42fc
commit
097a841961
@ -104,4 +104,4 @@ Bashbot is not more (in)secure as any other Bot written in any other language, w
|
||||
|
||||
If you feel that there's something missing or if you found a bug, feel free to submit a pull request!
|
||||
|
||||
#### $$VERSION$$ v0.70-dev2-16-gc6d4086
|
||||
#### $$VERSION$$ v0.70-dev2-17-g92ad9e4
|
||||
|
@ -168,5 +168,5 @@ That's it!
|
||||
If you feel that there's something missing or if you found a bug, feel
|
||||
free to submit a pull request!
|
||||
|
||||
latexmath:[\[VERSION\]] v0.70-dev2-16-gc6d4086
|
||||
latexmath:[\[VERSION\]] v0.70-dev2-17-g92ad9e4
|
||||
++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
# description: Start or stop telegram-bash-bot
|
||||
#
|
||||
#### $$VERSION$$ v0.70-dev2-16-gc6d4086
|
||||
#### $$VERSION$$ v0.70-dev2-17-g92ad9e4
|
||||
# shellcheck disable=SC2009
|
||||
# shellcheck disable=SC2181
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
# This file is public domain in the USA and all free countries.
|
||||
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
||||
#
|
||||
#### $$VERSION$$ v0.70-dev2-16-gc6d4086
|
||||
#### $$VERSION$$ v0.70-dev2-17-g92ad9e4
|
||||
#
|
||||
# Exit Codes:
|
||||
# - 0 sucess (hopefully)
|
||||
|
@ -5,7 +5,7 @@
|
||||
# This file is public domain in the USA and all free countries.
|
||||
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
||||
#
|
||||
#### $$VERSION$$ v0.70-dev2-16-gc6d4086
|
||||
#### $$VERSION$$ v0.70-dev2-17-g92ad9e4
|
||||
#
|
||||
# shellcheck disable=SC2154
|
||||
# shellcheck disable=SC2034
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
#### $$VERSION$$ v0.70-dev2-16-gc6d4086
|
||||
#### $$VERSION$$ v0.70-dev2-17-g92ad9e4
|
||||
|
||||
# magic to ensure that we're always inside the root of our application,
|
||||
# no matter from which directory we'll run script
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
#### $$VERSION$$ v0.70-dev2-16-gc6d4086
|
||||
#### $$VERSION$$ v0.70-dev2-17-g92ad9e4
|
||||
|
||||
# magic to ensure that we're always inside the root of our application,
|
||||
# no matter from which directory we'll run script
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
# this has to run once atfer git clone
|
||||
# and every time we create new hooks
|
||||
#### $$VERSION$$ v0.70-dev2-16-gc6d4086
|
||||
#### $$VERSION$$ v0.70-dev2-17-g92ad9e4
|
||||
|
||||
# magic to ensure that we're always inside the root of our application,
|
||||
# no matter from which directory we'll run script
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
# this has to run once atfer git clone
|
||||
# and every time we create new hooks
|
||||
#### $$VERSION$$ v0.70-dev2-16-gc6d4086
|
||||
#### $$VERSION$$ v0.70-dev2-17-g92ad9e4
|
||||
|
||||
# magic to ensure that we're always inside the root of our application,
|
||||
# no matter from which directory we'll run script
|
||||
|
@ -1,3 +1,3 @@
|
||||
# list of additional files to check from shellcheck
|
||||
#### $$VERSION$$ v0.70-dev2-16-gc6d4086
|
||||
#### $$VERSION$$ v0.70-dev2-17-g92ad9e4
|
||||
bashbot.rc
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
#### $$VERSION$$ v0.70-dev2-16-gc6d4086
|
||||
#### $$VERSION$$ v0.70-dev2-17-g92ad9e4
|
||||
# shellcheck disable=SC2016
|
||||
#
|
||||
# Easy Versioning in git:
|
||||
|
@ -61,5 +61,5 @@ group. This step is up to you actually.
|
||||
|
||||
#### [Next Getting started](2_usage.md)
|
||||
|
||||
#### $$VERSION$$ v0.70-dev2-16-gc6d4086
|
||||
#### $$VERSION$$ v0.70-dev2-17-g92ad9e4
|
||||
|
||||
|
@ -166,5 +166,5 @@ send_action "${CHAT[ID]}" "action"
|
||||
#### [Prev Create Bot](1_firstbot.md)
|
||||
#### [Next Advanced Usage](3_advanced.md)
|
||||
|
||||
#### $$VERSION$$ v0.70-dev2-16-gc6d4086
|
||||
#### $$VERSION$$ v0.70-dev2-17-g92ad9e4
|
||||
|
||||
|
@ -156,5 +156,5 @@ answer_inline_query "$iQUERY_ID" "cached_sticker" "identifier for the sticker"
|
||||
#### [Prev Advanced Usage](3_advanced.md)
|
||||
#### [Next Expert Use](4_expert.md)
|
||||
|
||||
#### $$VERSION$$ v0.70-dev2-16-gc6d4086
|
||||
#### $$VERSION$$ v0.70-dev2-17-g92ad9e4
|
||||
|
||||
|
@ -104,5 +104,5 @@ An example crontab is provided in ```examples/bashbot.cron```.
|
||||
#### [Prev Expert Use](4_expert.md)
|
||||
#### [Next Best Practice](5_practice.md)
|
||||
|
||||
#### $$VERSION$$ v0.70-dev2-16-gc6d4086
|
||||
#### $$VERSION$$ v0.70-dev2-17-g92ad9e4
|
||||
|
||||
|
@ -112,5 +112,5 @@ The second warning is about an unused variable, this is true because in our exam
|
||||
#### [Prev Best Practice](5_practice.md)
|
||||
#### [Next Functions Reference](6_reference.md)
|
||||
|
||||
#### $$VERSION$$ v0.70-dev2-16-gc6d4086
|
||||
#### $$VERSION$$ v0.70-dev2-17-g92ad9e4
|
||||
|
||||
|
@ -420,5 +420,5 @@ Send Input from Telegram to waiting Interactive Chat.
|
||||
#### [Prev Best Practice](5_practice.md)
|
||||
#### [Next Notes for Developers](7_develop.md)
|
||||
|
||||
#### $$VERSION$$ v0.70-dev2-16-gc6d4086
|
||||
#### $$VERSION$$ v0.70-dev2-17-g92ad9e4
|
||||
|
||||
|
@ -71,5 +71,5 @@ fi
|
||||
#### [Prev Function Reference](6_function.md)
|
||||
#### [Next Bashbot Environment](8_custom.md)
|
||||
|
||||
#### $$VERSION$$ v0.70-dev2-16-gc6d4086
|
||||
#### $$VERSION$$ v0.70-dev2-17-g92ad9e4
|
||||
|
||||
|
@ -131,5 +131,5 @@ for every poll until the maximum of BASHBOT_SLEEP ms.
|
||||
|
||||
#### [Prev Notes for Developers](7_develop.md)
|
||||
|
||||
#### $$VERSION$$ v0.70-dev2-16-gc6d4086
|
||||
#### $$VERSION$$ v0.70-dev2-17-g92ad9e4
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
# This file is public domain in the USA and all free countries.
|
||||
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
||||
#
|
||||
#### $$VERSION$$ v0.70-dev2-16-gc6d4086
|
||||
#### $$VERSION$$ v0.70-dev2-17-g92ad9e4
|
||||
|
||||
|
||||
SHELL=/bin/sh
|
||||
|
@ -3,7 +3,7 @@
|
||||
# This file is public domain in the USA and all free countries.
|
||||
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
||||
|
||||
#### $$VERSION$$ v0.70-dev2-16-gc6d4086
|
||||
#### $$VERSION$$ v0.70-dev2-17-g92ad9e4
|
||||
|
||||
# adjust your language setting here
|
||||
# https://github.com/topkecleon/telegram-bot-bash#setting-up-your-environment
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
# This file is public domain in the USA and all free countries.
|
||||
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
||||
#### $$VERSION$$ v0.70-dev2-16-gc6d4086
|
||||
#### $$VERSION$$ v0.70-dev2-17-g92ad9e4
|
||||
|
||||
# adjust your language setting here
|
||||
# https://github.com/topkecleon/telegram-bot-bash#setting-up-your-environment
|
||||
|
@ -3,7 +3,7 @@
|
||||
# This file is public domain in the USA and all free countries.
|
||||
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
||||
|
||||
#### $$VERSION$$ v0.70-dev2-16-gc6d4086
|
||||
#### $$VERSION$$ v0.70-dev2-17-g92ad9e4
|
||||
|
||||
# adjust your language setting here
|
||||
# https://github.com/topkecleon/telegram-bot-bash#setting-up-your-environment
|
||||
|
@ -3,7 +3,7 @@
|
||||
# This file is public domain in the USA and all free countries.
|
||||
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
||||
|
||||
#### $$VERSION$$ v0.70-dev2-16-gc6d4086
|
||||
#### $$VERSION$$ v0.70-dev2-17-g92ad9e4
|
||||
|
||||
# adjust your language setting here
|
||||
# https://github.com/topkecleon/telegram-bot-bash#setting-up-your-environment
|
||||
|
@ -5,7 +5,7 @@
|
||||
# This file is public domain in the USA and all free countries.
|
||||
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
||||
#
|
||||
#### $$VERSION$$ v0.70-dev2-16-gc6d4086
|
||||
#### $$VERSION$$ v0.70-dev2-17-g92ad9e4
|
||||
|
||||
# source from commands.sh to use the aliases
|
||||
# some handy aliases for use when processing messages:
|
||||
|
@ -5,16 +5,19 @@
|
||||
# This file is public domain in the USA and all free countries.
|
||||
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
||||
#
|
||||
#### $$VERSION$$ v0.70-dev2-15-g03f22c9
|
||||
#### $$VERSION$$ v0.70-dev2-17-g92ad9e4
|
||||
|
||||
# source from commands.sh if you want ro use interactive or background jobs
|
||||
|
||||
## to statisfy shellcheck
|
||||
export res
|
||||
|
||||
####
|
||||
# I placed send_message here because main use case is interactive chats and background jobs
|
||||
send_message() {
|
||||
local text arg keyboard file lat long title address sent
|
||||
[ "$2" = "" ] && return 1
|
||||
local chat="$1"
|
||||
local mychat="$1"
|
||||
text="$(echo "$2" | sed 's/ mykeyboardstartshere.*//g;s/ myfilelocationstartshere.*//g;s/ mylatstartshere.*//g;s/ mylongstartshere.*//g;s/ mytitlestartshere.*//g;s/ myaddressstartshere.*//g;s/ mykeyboardendshere.*//g')"
|
||||
arg="$3"
|
||||
[ "$arg" != "safe" ] && {
|
||||
@ -35,31 +38,31 @@ send_message() {
|
||||
|
||||
}
|
||||
if [ "$no_keyboard" != "" ]; then
|
||||
echo "remove_keyboard $chat $text" > "${TMPDIR:-.}/prova"
|
||||
remove_keyboard "$chat" "$text"
|
||||
echo "remove_keyboard $mychat $text" > "${TMPDIR:-.}/prova"
|
||||
remove_keyboard "$mychat" "$text"
|
||||
sent=y
|
||||
fi
|
||||
if [ "$keyboard" != "" ]; then
|
||||
if [[ "$keyboard" != *"["* ]]; then # pre 0.60 style
|
||||
keyboard="[ ${keyboard//\" \"/\" \] , \[ \"} ]"
|
||||
fi
|
||||
send_keyboard "$chat" "$text" "$keyboard"
|
||||
send_keyboard "$mychat" "$text" "$keyboard"
|
||||
sent=y
|
||||
fi
|
||||
if [ "$file" != "" ]; then
|
||||
send_file "$chat" "$file" "$text"
|
||||
send_file "$mychat" "$file" "$text"
|
||||
sent=y
|
||||
fi
|
||||
if [ "$lat" != "" ] && [ "$long" != "" ] && [ "$address" = "" ] && [ "$title" = "" ]; then
|
||||
send_location "$chat" "$lat" "$long"
|
||||
send_location "$mychat" "$lat" "$long"
|
||||
sent=y
|
||||
fi
|
||||
if [ "$lat" != "" ] && [ "$long" != "" ] && [ "$address" != "" ] && [ "$title" != "" ]; then
|
||||
send_venue "$chat" "$lat" "$long" "$title" "$address"
|
||||
send_venue "$mychat" "$lat" "$long" "$title" "$address"
|
||||
sent=y
|
||||
fi
|
||||
if [ "$sent" != "y" ];then
|
||||
send_text "$chat" "$text"
|
||||
send_text "$mychat" "$text"
|
||||
fi
|
||||
|
||||
}
|
||||
@ -82,7 +85,7 @@ send_text() {
|
||||
# interactive and background functions
|
||||
|
||||
background() {
|
||||
echo "${CHAT[ID]}:$2:$1" >"${TMPDIR:-.}/${copname}$2-back.cmd"
|
||||
echo "${CHAT[ID]}:$2:$1" >"${TMPDIR:-.}/${copname:--}$2-back.cmd"
|
||||
startproc "$1" "back-$2-"
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
# files: mycommands.sh.dist
|
||||
# copy to mycommands.sh and add all your commands and functions here ...
|
||||
#
|
||||
#### $$VERSION$$ v0.70-dev2-16-gc6d4086
|
||||
#### $$VERSION$$ v0.70-dev2-17-g92ad9e4
|
||||
#
|
||||
# shellcheck disable=SC2154
|
||||
# shellcheck disable=SC2034
|
||||
|
@ -2,7 +2,7 @@
|
||||
#
|
||||
# ADD a new test skeleton to test dir, but does not activate test
|
||||
#
|
||||
#### $$VERSION$$ v0.70-dev2-16-gc6d4086
|
||||
#### $$VERSION$$ v0.70-dev2-17-g92ad9e4
|
||||
|
||||
# magic to ensure that we're always inside the root of our application,
|
||||
# no matter from which directory we'll run script
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
#### $$VERSION$$ v0.70-dev2-16-gc6d4086
|
||||
#### $$VERSION$$ v0.70-dev2-17-g92ad9e4
|
||||
|
||||
# common variables
|
||||
export TESTME DIRME TESTDIR LOGFILE REFDIR TESTNAME
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
# this has to run once atfer git clone
|
||||
# and every time we create new hooks
|
||||
#### $$VERSION$$ v0.70-dev2-16-gc6d4086
|
||||
#### $$VERSION$$ v0.70-dev2-17-g92ad9e4
|
||||
|
||||
# magic to ensure that we're always inside the root of our application,
|
||||
# no matter from which directory we'll run script
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
#### $$VERSION$$ v0.70-dev2-16-gc6d4086
|
||||
#### $$VERSION$$ v0.70-dev2-17-g92ad9e4
|
||||
|
||||
../dev/hooks/pre-commit.sh
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
#### $$VERSION$$ v0.70-dev2-16-gc6d4086
|
||||
#### $$VERSION$$ v0.70-dev2-17-g92ad9e4
|
||||
|
||||
../dev/hooks/pre-push.sh
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
#### $$VERSION$$ v0.70-dev2-16-gc6d4086
|
||||
#### $$VERSION$$ v0.70-dev2-17-g92ad9e4
|
||||
|
||||
# include common functions and definitions
|
||||
# shellcheck source=test/ALL-tests.inc.sh
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
#### $$VERSION$$ v0.70-dev2-16-gc6d4086
|
||||
#### $$VERSION$$ v0.70-dev2-17-g92ad9e4
|
||||
|
||||
# include common functions and definitions
|
||||
# shellcheck source=test/ALL-tests.inc.sh
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
#### $$VERSION$$ v0.70-dev2-16-gc6d4086
|
||||
#### $$VERSION$$ v0.70-dev2-17-g92ad9e4
|
||||
|
||||
# include common functions and definitions
|
||||
# shellcheck source=test/ALL-tests.inc.sh
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
#### $$VERSION$$ v0.70-dev2-16-gc6d4086
|
||||
#### $$VERSION$$ v0.70-dev2-17-g92ad9e4
|
||||
|
||||
# include common functions and definitions
|
||||
# shellcheck source=test/ALL-tests.inc.sh
|
||||
|
Loading…
x
Reference in New Issue
Block a user