From cf0c4899873b26e0e99f046fe26d8a7f01d22f15 Mon Sep 17 00:00:00 2001 From: David Coomber <47242934+dcoomber@users.noreply.github.com> Date: Sun, 6 Sep 2020 18:48:47 +0200 Subject: [PATCH 1/6] Corrected references to bashbot.rc and dev/all-tests.sh; other cosmetic updates --- doc/0_install.md | 4 ++-- doc/2_usage.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/0_install.md b/doc/0_install.md index 72b3399..7ef2e4c 100644 --- a/doc/0_install.md +++ b/doc/0_install.md @@ -7,7 +7,7 @@ * /usr/local if you want to run as service 2. [Download latest release zip from github](https://github.com/topkecleon/telegram-bot-bash/releases) and extract all files. 3. Change into the directory ```telegram-bot-bash``` -4. Acticate the bot example commands ``cp mycommands.sh.dist mycommands.sh``` +4. Activate the bot example commands ``cp mycommands.sh.dist mycommands.sh``` 5. Run ```./bashbot.sh init``` to setup the environment and enter your Bots token given by botfather. Edit 'mycommands.sh to your needs. @@ -24,7 +24,7 @@ As an alternative to download the zip files, you can clone the github repository * /usr/local if you want to run as service 2. Run ```git clone https://github.com/topkecleon/telegram-bot-bash.git``` 3. Change into the directory ```telegram-bot-bash``` -4. Run ``` test/ALL-tests.sh``` and if everything finish OK ... +4. Run ``` dev/all-tests.sh``` and if everything finish OK ... 5. Run ```sudo ./bashbot.sh init``` to setup the environment and enter your Bots token given by botfather. ### Update bashbot diff --git a/doc/2_usage.md b/doc/2_usage.md index af37b8c..816d0f2 100644 --- a/doc/2_usage.md +++ b/doc/2_usage.md @@ -47,7 +47,7 @@ Have FUN! │   ├── antiFlood.sh # simple addon taking actions based on # files and text sent to chat │   └── xxxxxage.sh │ -├── bashbot.rc # start/stop script if you run basbot as service +├── bashbot.rc # start/stop script if you run bashbot as service │ ├── examples # example scripts and configs for bashbot │   ├── README.md # description of files and examples From 6de7be098eb68505e7fdb8deeea7c8aece1d3544 Mon Sep 17 00:00:00 2001 From: David Coomber <47242934+dcoomber@users.noreply.github.com> Date: Sun, 6 Sep 2020 18:50:12 +0200 Subject: [PATCH 2/6] Fixed comment references to mycommands.sh; various cosmetic changes --- commands.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/commands.sh b/commands.sh index 9950fbe..fcb1fae 100644 --- a/commands.sh +++ b/commands.sh @@ -9,7 +9,7 @@ # |_____/ \___/ |_| |_|\___/ \___) |_______)____|_|\___)_| # # this file *MUST* not be edited! place your config and commands in -# the file "mycommnds.sh". a clean version is provided as "mycommands.clean" +# the file "mycommands.sh". a clean version is provided as "mycommands.sh.clean" # # This file is public domain in the USA and all free countries. @@ -18,7 +18,7 @@ #### $$VERSION$$ v1.0-0-g99217c4 # -# adjust your language setting here, e.g.when run from other user or cron. +# adjust your language setting here, e.g. when run from other user or cron. # https://github.com/topkecleon/telegram-bot-bash#setting-up-your-environment export 'LC_ALL=C.UTF-8' export 'LANG=C.UTF-8' @@ -29,7 +29,7 @@ unset IFS #----------------------------- # this file *MUST* not edited! -# copy "mycommands.sh.dist" to "mycommnds.sh" and change the strings there +# copy "mycommands.sh.dist" to "mycommands.sh" and change the strings there bashbot_info='This is bashbot, the Telegram bot written entirely in bash. It features background tasks and interactive chats, and can serve as an interface for CLI programs. It currently can send, receive and forward messages, custom keyboards, photos, audio, voice, documents, locations and video files. @@ -37,7 +37,7 @@ It currently can send, receive and forward messages, custom keyboards, photos, a #----------------------------- # this file *MUST* not edited! -# copy "mycommands.sh.dist" to "mycommnds.sh" and change the strings there +# copy "mycommands.sh.dist" to "mycommands.sh" and change the strings there bashbot_help='Place your own commands and messages in mycommands.sh *Available commands*: @@ -65,7 +65,7 @@ fi #---------------------------- # this file *MUST* not edited! -# copy "mycommands.sh.dist" to "mycommnds.sh" and change the values there +# copy "mycommands.sh.dist" to "mycommands.sh" and change the values there # defaults to no inline and nonsense home dir export INLINE="0" export FILE_REGEX="${BASHBOT_ETC}/.*" @@ -97,7 +97,7 @@ if [ -z "${1}" ] || [[ "${1}" == *"debug"* ]];then case "${MESSAGE}" in ################################################ # this file *MUST* not edited! - # copy "mycommands.sh.dist" to "mycommnds.sh" and change the values and add your commands there + # copy "mycommands.sh.dist" to "mycommands.sh" and change the values and add your commands there # # GLOBAL commands start here, edit messages only '/info'*) From 5212a990b1c240fb910a4904607cbc212f94db1a Mon Sep 17 00:00:00 2001 From: David Coomber <47242934+dcoomber@users.noreply.github.com> Date: Sun, 6 Sep 2020 18:51:34 +0200 Subject: [PATCH 3/6] Fixed comments relating to mycommmands.sh; Updated text in first message after startup --- mycommands.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mycommands.sh b/mycommands.sh index 2a26787..16b4ff6 100644 --- a/mycommands.sh +++ b/mycommands.sh @@ -15,7 +15,7 @@ # use ${ME} for current bot name in messages # Note: you must escape '_' in botname with two \ in markdown messages! export bashbot_info='This is @'"${ME//_/\\\\_}"', the Telegram example bot written entirely in bash. -Edit commands and messages in mycommnds.sh! +Edit commands and messages in mycommands.sh! ' # export bashbot_help='*Available commands*: #' @@ -89,7 +89,7 @@ else # action triggered on first message after startup if [[ "$(getConfigKey "startupaction")" != "done"* ]]; then # send message to first user on startup - send_normal_message "${CHAT[ID]}" "Hi, you was the first one after startup!" + send_normal_message "${CHAT[ID]}" "Hi, you are the first user after startup!" # mark as done and when setConfigKey "startupaction" "done $(date)" fi From 22372f10fa78aed6e18ef4da7247bbd9da392ccc Mon Sep 17 00:00:00 2001 From: David Coomber <47242934+dcoomber@users.noreply.github.com> Date: Sun, 6 Sep 2020 18:53:26 +0200 Subject: [PATCH 4/6] Updated to be compliant with SC2230: which is non-standard. Use builtin 'command -v' instead. --- dev/hooks/pre-commit.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/hooks/pre-commit.sh b/dev/hooks/pre-commit.sh index f9da3f3..6ce51cc 100755 --- a/dev/hooks/pre-commit.sh +++ b/dev/hooks/pre-commit.sh @@ -65,7 +65,7 @@ else exit 1 fi -if which codespell &>/dev/null; then +if command -v codespell &>/dev/null; then echo "Running codespell" echo "............................" codespell -B 1 --skip="*.log,*.html,*.txt,.git*,jsonDB-keyboard" -L "ba" From aa1ca143d6ab7b46520fc4eb16de7718f853bd7c Mon Sep 17 00:00:00 2001 From: David Coomber <47242934+dcoomber@users.noreply.github.com> Date: Sun, 6 Sep 2020 18:54:50 +0200 Subject: [PATCH 5/6] Updated prompt references to basbot / BASBOT to bashbot / BASHBOT --- bashbot.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bashbot.sh b/bashbot.sh index 3c48b4a..b7d3c35 100755 --- a/bashbot.sh +++ b/bashbot.sh @@ -633,8 +633,8 @@ process_client() { jssh_countKeyDB_async "${CHAT[ID]}" "${COUNTFILE}" } -declare -Ax BASBOT_EVENT_INLINE BASBOT_EVENT_MESSAGE BASHBOT_EVENT_CMD BASBOT_EVENT_REPLY BASBOT_EVENT_FORWARD BASHBOT_EVENT_SEND -declare -Ax BASBOT_EVENT_CONTACT BASBOT_EVENT_LOCATION BASBOT_EVENT_FILE BASHBOT_EVENT_TEXT BASHBOT_EVENT_TIMER BASHBOT_BLOCKED +declare -Ax BASHBOT_EVENT_INLINE BASHBOT_EVENT_MESSAGE BASHBOT_EVENT_CMD BASHBOT_EVENT_REPLY BASHBOT_EVENT_FORWARD BASHBOT_EVENT_SEND +declare -Ax BASHBOT_EVENT_CONTACT BASHBOT_EVENT_LOCATION BASHBOT_EVENT_FILE BASHBOT_EVENT_TEXT BASHBOT_EVENT_TIMER BASHBOT_BLOCKED start_timer(){ # send alarm every ~60 s @@ -1006,7 +1006,7 @@ bot_init() { fi #setup bashbot [[ "${UID}" -eq "0" ]] && RUNUSER="nobody" - echo -n "Enter User to run basbot [$RUNUSER]: " + echo -n "Enter User to run bashbot [$RUNUSER]: " read -r TOUSER [ -z "$TOUSER" ] && TOUSER="$RUNUSER" if ! id "$TOUSER" &>/dev/null; then From f2ff9471d92508d406f401baeca9224ef93a1ef5 Mon Sep 17 00:00:00 2001 From: David Coomber <47242934+dcoomber@users.noreply.github.com> Date: Sun, 6 Sep 2020 18:56:13 +0200 Subject: [PATCH 6/6] Fixed references from test/all-tests.sh and changed final message --- dev/all-tests.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dev/all-tests.sh b/dev/all-tests.sh index e235953..5193203 100755 --- a/dev/all-tests.sh +++ b/dev/all-tests.sh @@ -26,7 +26,7 @@ passed=0 #echo PLAN ${#all_tests} for test in $(find ./*-test.sh | sort -u) ; do - [ "${test}" = "test/all-tests.sh" ] && continue + [ "${test}" = "dev/all-tests.sh" ] && continue [ ! -x "${test}" ] && continue tests=$((tests+1)) echo "TEST: ${test}" @@ -56,6 +56,6 @@ fi echo -e "${passed} / ${tests}\\n" [ -d "${TESTENV}" ] && echo "Logfiles from run are in ${TESTENV}" -ls -ld /tmp/bashbot.test* 2>/dev/null && echo "Don not forget to deleted bashbot test files in /tmp!!" +ls -ld /tmp/bashbot.test* 2>/dev/null && echo "Do not forget to delete bashbot test files in /tmp!!" exit ${exitcode}