diff --git a/.gitignore b/.gitignore index cda6e25..b977922 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,9 @@ *~ +/.github/ /count /token *.save *.log -/JSON.sh/* +/JSON.sh/ /tmp-bot-bash/ +/dist/ diff --git a/README.md b/README.md index 5a4d710..0ef3e69 100644 --- a/README.md +++ b/README.md @@ -20,11 +20,11 @@ Bashbot [Documentation](https://github.com/topkecleon/telegram-bot-bash) and [Do 1. Go to the directory you want to install bashbot, e.g. * your $HOME directory (install and run with your user-ID) * /usr/local if you want to run as service -2. [Download latest release](https://github.com/topkecleon/telegram-bot-bash/releases) archive from github and extract all files. +2. [Download latest release zip from github](https://github.com/topkecleon/telegram-bot-bash/releases) and extract all files. - As an alternative you can clone the github repository to get the latest, but possible unstable improvements. + As an alternative you can clone the github repository to get the latest improvements, run All-tests.sh to be shure. ``` - git clone https://github.com/topkecleon/telegram-bot-bash + git clone https://github.com/topkecleon/telegram-bot-bash; test/ALL-tests.sh ``` 3. Go to directory ```telegram-bot-bash```, run ```./bashbot.sh init``` and follow the instructions. At this point you are asked for your Bots token given by botfather. @@ -102,4 +102,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.62-0-g5d5dbae +#### $$VERSION$$ v0.70-dev2-0-g4fff4c3 diff --git a/README.txt b/README.txt index 56472e7..74c3ffc 100644 --- a/README.txt +++ b/README.txt @@ -31,13 +31,13 @@ Install bashbot * your $HOME directory (install and run with your user-ID) * /usr/local if you want to run as service 2. https://github.com/topkecleon/telegram-bot-bash/releases[Download -latest release] archive from github and extract all files. +latest release zip from github] and extract all files. + -As an alternative you can clone the github repository to get the latest, -but possible unstable improvements. +As an alternative you can clone the github repository to get the latest +improvements, run All-tests.sh to be shure. + .... -git clone https://github.com/topkecleon/telegram-bot-bash +git clone https://github.com/topkecleon/telegram-bot-bash; test/ALL-tests.sh .... 3. Go to directory `telegram-bot-bash`, run `./bashbot.sh init` and follow the instructions. At this point you are asked for your Bots token @@ -166,5 +166,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.62-0-g5d5dbae -++++++++++++++++++++++++++++++++++++++++ +latexmath:[\[VERSION\]] v0.70-dev2-0-g4fff4c3 ++++++++++++++++++++++++++++++++++++++++++++++ diff --git a/bashbot.rc b/bashbot.rc index e729f9e..a422b62 100755 --- a/bashbot.rc +++ b/bashbot.rc @@ -1,7 +1,7 @@ #!/bin/sh # description: Start or stop telegram-bash-bot # -#### $$VERSION$$ v0.62-0-g5d5dbae +#### $$VERSION$$ v0.70-dev2-0-g4fff4c3 # shellcheck disable=SC2009 # shellcheck disable=SC2181 diff --git a/bashbot.sh b/bashbot.sh index 84d5a4b..5dbd71e 100755 --- a/bashbot.sh +++ b/bashbot.sh @@ -10,7 +10,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.62-0-g5d5dbae +#### $$VERSION$$ v0.70-dev2-0-g4fff4c3 # # Exit Codes: # - 0 sucess (hopefully) diff --git a/commands.sh b/commands.sh index 21df7ed..f5ee34e 100755 --- a/commands.sh +++ b/commands.sh @@ -4,7 +4,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.62-0-g5d5dbae +#### $$VERSION$$ v0.70-dev2-0-g4fff4c3 # # shellcheck disable=SC2154 # shellcheck disable=SC2034 diff --git a/dev/hooks/pre-commit.sh b/dev/hooks/pre-commit.sh index 38cbc16..a627052 100755 --- a/dev/hooks/pre-commit.sh +++ b/dev/hooks/pre-commit.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -#### $$VERSION$$ v0.62-0-g5d5dbae +#### $$VERSION$$ v0.70-dev2-0-g4fff4c3 # magic to ensure that we're always inside the root of our application, # no matter from which directory we'll run script @@ -8,20 +8,18 @@ cd "$GIT_DIR/.." || exit 1 export HOOKDIR="dev/hooks" -echo "Running pre-commit hook" # if any command inside script returns error, exit and return that error set -e -# let's fake failing test for now -echo "Running tests" +echo "Running pre-commit hook" echo "............................" unset IFS; set -f # check for shellcheck if which shellcheck >/dev/null 2>&1; then - echo "Test all scripts with shellcheck ..." + echo " Test all scripts with shellcheck ..." else echo "Error: shellcheck is not installed. Install shellcheck or delete $0" exit 1 @@ -29,13 +27,13 @@ fi # run shellcheck before commit set +f -FILES="$(find ./* -name '*.sh')" +FILES="$(find ./* -name '*.sh' | grep -v 'dist\/' )" set -f FILES="${FILES} $(sed '/^#/d' <"dev/shellcheck.files")" if [ "$FILES" != "" ]; then # shellcheck disable=SC2086 shellcheck -x ${FILES} || exit 1 - echo "OK" + echo " OK" else # something went wrong exit 1 diff --git a/dev/hooks/pre-push.sh b/dev/hooks/pre-push.sh index 6b4179b..f79bb5f 100755 --- a/dev/hooks/pre-push.sh +++ b/dev/hooks/pre-push.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -#### $$VERSION$$ v0.62-0-g5d5dbae +#### $$VERSION$$ v0.70-dev2-0-g4fff4c3 # magic to ensure that we're always inside the root of our application, # no matter from which directory we'll run script @@ -11,13 +11,11 @@ export HOOKDIR="dev/hooks" REMOTEVER="$(git ls-remote -t --refs 2>/dev/null | tail -1 | sed 's/.*\/v//')" VERSION="$(git describe --tags | sed -e 's/-.*//' -e 's/v//')" -echo "Running pre-push hook" # if any command inside script returns error, exit and return that error set -e -# let's fake failing test for now -echo "Running tests" +echo "Running pre-push hook" echo "............................" unset IFS; set -f @@ -25,7 +23,9 @@ unset IFS; set -f # LOCAL version must greater than latest REMOTE release version if (( $(echo "${VERSION} > ${REMOTEVER}" | bc -l) )); then # update version in bashbot files on push - dev/version.sh 2>/dev/null + echo -n " " + dev/version.sh 2>/dev/null || exit 1 + echo " OK" else echo "Error: local version ${VERSION} must be greater than latest release version." echo "use \"git tag ...\" to create a local version greater than ${REMOTEVER}" diff --git a/dev/install-hooks.sh b/dev/install-hooks.sh index 3b038c7..eec30a2 100755 --- a/dev/install-hooks.sh +++ b/dev/install-hooks.sh @@ -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.62-0-g5d5dbae +#### $$VERSION$$ v0.70-dev2-0-g4fff4c3 # magic to ensure that we're always inside the root of our application, # no matter from which directory we'll run script diff --git a/dev/make-dist.sh b/dev/make-dist.sh new file mode 100755 index 0000000..125df10 --- /dev/null +++ b/dev/make-dist.sh @@ -0,0 +1,56 @@ +#!/usr/bin/env bash +# this has to run once atfer git clone +# and every time we create new hooks +#### $$VERSION$$ v0.70-dev2-0-g4fff4c3 + +# magic to ensure that we're always inside the root of our application, +# no matter from which directory we'll run script +GIT_DIR=$(git rev-parse --git-dir) +cd "$GIT_DIR/.." || exit 1 + +VERSION="$(git describe --tags | sed -e 's/-.*//' -e 's/v//')" + +DISTNAME="telegram-bot-bash" +DISTDIR="./dist/${DISTNAME}" +DISTFILES="bashbot.rc bashbot.sh commands.sh doc examples LICENSE README.md README.txt" + +# run tests first! + +for test in dev/hooks/* "test/ALL-tests.sh" +do + if ! "${test}" ; then + echo "Test ${test} failed, can't create dist!" + exit 1 + fi +done + +# create dir for sitribution and copy files +mkdir -p "${DISTDIR}" 2>/dev/null +# shellcheck disable=SC2086 +cp -r ${DISTFILES} "${DISTDIR}" +cd "${DISTDIR}" || exit 1 + +# additional stuff +mv "commands.sh" "commands.sh.dist" + +JSONSHFILE="JSON.sh/JSON.sh" +if [ ! -f "${JSONSHFILE}" ]; then + mkdir "JSON.sh" 2>/dev/null; + curl -sL -o "${JSONSHFILE}" "https://cdn.jsdelivr.net/gh/dominictarr/JSON.sh/JSON.sh" + chmod +x "${JSONSHFILE}" +fi + +# create archive +cd .. || exit 1 +zip -rq "${DISTNAME}-${VERSION}.zip" "${DISTNAME}" +tar -czf "${DISTNAME}-${VERSION}.tar.gz" "${DISTNAME}" + + +# shellcheck disable=SC2086 +ls -ld ${DISTNAME}-${VERSION}.* + +# remove temporary dist dir +cd "$GIT_DIR/.." || exit 1 +rm -rf ${DISTDIR} + + diff --git a/dev/shellcheck.files b/dev/shellcheck.files index 24a3dc5..11dffe3 100644 --- a/dev/shellcheck.files +++ b/dev/shellcheck.files @@ -1,3 +1,3 @@ # list of additional files to check from shellcheck -#### $$VERSION$$ v0.62-0-g5d5dbae +#### $$VERSION$$ v0.70-dev2-0-g4fff4c3 bashbot.rc diff --git a/dev/version.sh b/dev/version.sh index 24f925c..92598c0 100755 --- a/dev/version.sh +++ b/dev/version.sh @@ -1,6 +1,6 @@ #!/bin/bash # -#### $$VERSION$$ v0.62-0-g5d5dbae +#### $$VERSION$$ v0.70-dev2-0-g4fff4c3 # shellcheck disable=SC2016 # # Easy Versioning in git: diff --git a/doc/1_firstbot.md b/doc/1_firstbot.md index 1c571da..eed1c90 100644 --- a/doc/1_firstbot.md +++ b/doc/1_firstbot.md @@ -61,5 +61,5 @@ group. This step is up to you actually. #### [Next Getting started](2_usage.md) -#### $$VERSION$$ v0.62-0-g5d5dbae +#### $$VERSION$$ v0.70-dev2-0-g4fff4c3 diff --git a/doc/2_usage.md b/doc/2_usage.md index 08fa1aa..bd3b632 100644 --- a/doc/2_usage.md +++ b/doc/2_usage.md @@ -159,5 +159,5 @@ send_action "${CHAT[ID]}" "action" #### [Prev Create Bot](1_firstbot.md) #### [Next Advanced Usage](3_advanced.md) -#### $$VERSION$$ v0.62-0-g5d5dbae +#### $$VERSION$$ v0.70-dev2-0-g4fff4c3 diff --git a/doc/3_advanced.md b/doc/3_advanced.md index fe18270..d4d0118 100644 --- a/doc/3_advanced.md +++ b/doc/3_advanced.md @@ -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.62-0-g5d5dbae +#### $$VERSION$$ v0.70-dev2-0-g4fff4c3 diff --git a/doc/4_expert.md b/doc/4_expert.md index 37ef179..594537f 100644 --- a/doc/4_expert.md +++ b/doc/4_expert.md @@ -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.62-0-g5d5dbae +#### $$VERSION$$ v0.70-dev2-0-g4fff4c3 diff --git a/doc/5_practice.md b/doc/5_practice.md index df7b663..e74fd19 100644 --- a/doc/5_practice.md +++ b/doc/5_practice.md @@ -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.62-0-g5d5dbae +#### $$VERSION$$ v0.70-dev2-0-g4fff4c3 diff --git a/doc/6_reference.md b/doc/6_reference.md index a4c52ff..050f00a 100644 --- a/doc/6_reference.md +++ b/doc/6_reference.md @@ -348,5 +348,5 @@ Send Input from Telegram to waiting Interactive Chat. #### [Prev Best Practice](5_practice.md) #### [Next Developer Rules](7_develop.md) -#### $$VERSION$$ v0.62-0-g5d5dbae +#### $$VERSION$$ v0.70-dev2-0-g4fff4c3 diff --git a/doc/7_develop.md b/doc/7_develop.md index e439a72..e841540 100644 --- a/doc/7_develop.md +++ b/doc/7_develop.md @@ -70,5 +70,5 @@ fi #### [Prev Function Reference](6_function.md) -#### $$VERSION$$ v0.62-0-g5d5dbae +#### $$VERSION$$ v0.70-dev2-0-g4fff4c3 diff --git a/examples/bashbot.cron b/examples/bashbot.cron index 854c8c7..451ab81 100644 --- a/examples/bashbot.cron +++ b/examples/bashbot.cron @@ -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.62-0-g5d5dbae +#### $$VERSION$$ v0.70-dev2-0-g4fff4c3 SHELL=/bin/sh diff --git a/examples/calc.sh b/examples/calc.sh index 97b3068..0f9c0af 100755 --- a/examples/calc.sh +++ b/examples/calc.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.62-0-g5d5dbae +#### $$VERSION$$ v0.70-dev2-0-g4fff4c3 # adjust your language setting here # https://github.com/topkecleon/telegram-bot-bash#setting-up-your-environment diff --git a/examples/notify.sh b/examples/notify.sh index 378d6af..0370695 100755 --- a/examples/notify.sh +++ b/examples/notify.sh @@ -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.62-0-g5d5dbae +#### $$VERSION$$ v0.70-dev2-0-g4fff4c3 # adjust your language setting here # https://github.com/topkecleon/telegram-bot-bash#setting-up-your-environment diff --git a/examples/question,sh b/examples/question,sh index c9bfaf8..249dfca 100755 --- a/examples/question,sh +++ b/examples/question,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.62-0-g5d5dbae +#### $$VERSION$$ v0.70-dev2-0-g4fff4c3 # adjust your language setting here # https://github.com/topkecleon/telegram-bot-bash#setting-up-your-environment diff --git a/examples/question.sh b/examples/question.sh index c9bfaf8..249dfca 100755 --- a/examples/question.sh +++ b/examples/question.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.62-0-g5d5dbae +#### $$VERSION$$ v0.70-dev2-0-g4fff4c3 # adjust your language setting here # https://github.com/topkecleon/telegram-bot-bash#setting-up-your-environment diff --git a/test/ALL-tests.inc.sh b/test/ALL-tests.inc.sh index fd0193f..045cda4 100755 --- a/test/ALL-tests.inc.sh +++ b/test/ALL-tests.inc.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -#### $$VERSION$$ v0.62-0-g5d5dbae +#### $$VERSION$$ v0.70-dev2-0-g4fff4c3 # common variables export TESTME DIRME TESTDIR LOGFILE REFDIR TESTNAME @@ -23,6 +23,7 @@ export SUCCESS NOSUCCESS NOSUCCESS=" FAILED!" # default input, reference and output files +export INPUTFILE REFFILE OUTPUTFILE INPUTFILE="${DIRME}/${REFDIR}/${REFDIR}.input" REFFILE="${DIRME}/${REFDIR}/${REFDIR}.result" OUTPUTFILE="${TESTDIR}/${REFDIR}.out" @@ -34,7 +35,7 @@ print_array() { for idx in "${arrays[@]}"; do declare -n temp="$idx" for t in "${!temp[@]}"; do - printf "%s:\t%s\t%s\n" "$idx" "$t" "${temp[$t]}" + printf '%s:\t%s\t%s\n' "$idx" "$t" "${temp[$t]}" done | sort done | grep -v '^USER: 0' } diff --git a/test/ALL-tests.sh b/test/ALL-tests.sh index 1604e96..86f237b 100755 --- a/test/ALL-tests.sh +++ b/test/ALL-tests.sh @@ -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.62-0-g5d5dbae +#### $$VERSION$$ v0.70-dev2-0-g4fff4c3 # magic to ensure that we're always inside the root of our application, # no matter from which directory we'll run script @@ -11,7 +11,7 @@ cd "${GIT_DIR}/.." || exit 1 # create test environment TESTENV="/tmp/bashbot.test$$" mkdir "${TESTENV}" -cp -r * "${TESTENV}" +cp -r ./* "${TESTENV}" cd "test" || exit 1 #set -e @@ -20,7 +20,7 @@ tests=0 passed=0 #all_tests=${__dirname:} #echo PLAN ${#all_tests} -for test in $(find ./${pass}*-test.sh | sort -u) ; +for test in $(find ./*-test.sh | sort -u) ; do [ "${test}" = "test/all-tests.sh" ] && continue [ ! -x "${test}" ] && continue diff --git a/test/a-commit-test.sh b/test/a-commit-test.sh old mode 100644 new mode 100755 index b270ade..da6cc90 --- a/test/a-commit-test.sh +++ b/test/a-commit-test.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -#### $$VERSION$$ v0.62-0-g5d5dbae +#### $$VERSION$$ v0.70-dev2-0-g4fff4c3 ../dev/hooks/pre-commit.sh diff --git a/test/a-push-test.sh b/test/a-push-test.sh old mode 100644 new mode 100755 index 597b420..6200f4c --- a/test/a-push-test.sh +++ b/test/a-push-test.sh @@ -1,4 +1,4 @@ #!/usr/bin/env bash -#### $$VERSION$$ v0.62-0-g5d5dbae +#### $$VERSION$$ v0.70-dev2-0-g4fff4c3 ../dev/hooks/pre-push.sh diff --git a/test/c-init-test.sh b/test/c-init-test.sh index d545d3d..593ffa8 100755 --- a/test/c-init-test.sh +++ b/test/c-init-test.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -#### $$VERSION$$ v0.62-0-g5d5dbae +#### $$VERSION$$ v0.70-dev2-0-g4fff4c3 # include common functions and definitions # shellcheck source=test/ALL-tests.inc.sh diff --git a/test/d-JSON.sh-test.sh b/test/d-JSON.sh-test.sh new file mode 100755 index 0000000..50fb2bc --- /dev/null +++ b/test/d-JSON.sh-test.sh @@ -0,0 +1,35 @@ +#!/usr/bin/env bash +#### $$VERSION$$ v0.70-dev2-0-g4fff4c3 + +# include common functions and definitions +# shellcheck source=test/ALL-tests.inc.sh +source "./ALL-tests.inc.sh" + +set -e + +# source bashbot.sh functionw +cd "${TESTDIR}" || exit 1 + +# run JSON.sh with and without options +cd "test" || exit 1 +echo "Check JSON.sh ..." +JSON="../JSON.sh/JSON.sh" + +for i in 1 2 +do + [ "${i}" = "1" ] && echo " ... JSON.sh -s -b -n" + [ "${i}" = "2" ] && echo " ... JSON.sh" + set +f + for jsonfile in ${REFDIR}/*.log + do + set -f + [ "${i}" = "1" ] && "${JSON}" -s -b -n <"${jsonfile}" >"${jsonfile}.out-${i}" + [ "${i}" = "2" ] && "${JSON}" <"${jsonfile}" >"${jsonfile}.out-${i}" + + # output processed input + diff -c "${jsonfile}.result-${i}" "${jsonfile}.out-${i}" || exit 1 + done + echo "${SUCCESS}" +done + +cd "${DIRME}" || exit 1 diff --git a/test/d-JSON.sh-test/JSON26783.log.result-1 b/test/d-JSON.sh-test/JSON26783.log.result-1 new file mode 100644 index 0000000..7810dc2 --- /dev/null +++ b/test/d-JSON.sh-test/JSON26783.log.result-1 @@ -0,0 +1,22 @@ +["ok"] true +["result",0,"update_id"] 146860898 +["result",0,"message","message_id"] 6620 +["result",0,"message","from","id"] 123456789 +["result",0,"message","from","is_bot"] false +["result",0,"message","from","first_name"] "Kay" +["result",0,"message","from","last_name"] "M" +["result",0,"message","from","username"] "Gnadelwartz" +["result",0,"message","from","language_code"] "de" +["result",0,"message","chat","id"] 123456789 +["result",0,"message","chat","first_name"] "Kay" +["result",0,"message","chat","last_name"] "M" +["result",0,"message","chat","username"] "Gnadelwartz" +["result",0,"message","chat","type"] "private" +["result",0,"message","date"] 1555934213 +["result",0,"message","location","latitude"] 49.630443 +["result",0,"message","location","longitude"] 8.361698 +["result",0,"message","venue","location","latitude"] 49.630443 +["result",0,"message","venue","location","longitude"] 8.361698 +["result",0,"message","venue","title"] "Vannini" +["result",0,"message","venue","address"] "K\u00e4mmererstr. 3" +["result",0,"message","venue","foursquare_id"] "4bf94ec05ec320a115f889d3" diff --git a/test/d-JSON.sh-test/JSON26783.log.result-2 b/test/d-JSON.sh-test/JSON26783.log.result-2 new file mode 100644 index 0000000..816e126 --- /dev/null +++ b/test/d-JSON.sh-test/JSON26783.log.result-2 @@ -0,0 +1,31 @@ +["ok"] true +["result",0,"update_id"] 146860898 +["result",0,"message","message_id"] 6620 +["result",0,"message","from","id"] 123456789 +["result",0,"message","from","is_bot"] false +["result",0,"message","from","first_name"] "Kay" +["result",0,"message","from","last_name"] "M" +["result",0,"message","from","username"] "Gnadelwartz" +["result",0,"message","from","language_code"] "de" +["result",0,"message","from"] {"id":123456789,"is_bot":false,"first_name":"Kay","last_name":"M","username":"Gnadelwartz","language_code":"de"} +["result",0,"message","chat","id"] 123456789 +["result",0,"message","chat","first_name"] "Kay" +["result",0,"message","chat","last_name"] "M" +["result",0,"message","chat","username"] "Gnadelwartz" +["result",0,"message","chat","type"] "private" +["result",0,"message","chat"] {"id":123456789,"first_name":"Kay","last_name":"M","username":"Gnadelwartz","type":"private"} +["result",0,"message","date"] 1555934213 +["result",0,"message","location","latitude"] 49.630443 +["result",0,"message","location","longitude"] 8.361698 +["result",0,"message","location"] {"latitude":49.630443,"longitude":8.361698} +["result",0,"message","venue","location","latitude"] 49.630443 +["result",0,"message","venue","location","longitude"] 8.361698 +["result",0,"message","venue","location"] {"latitude":49.630443,"longitude":8.361698} +["result",0,"message","venue","title"] "Vannini" +["result",0,"message","venue","address"] "K\u00e4mmererstr. 3" +["result",0,"message","venue","foursquare_id"] "4bf94ec05ec320a115f889d3" +["result",0,"message","venue"] {"location":{"latitude":49.630443,"longitude":8.361698},"title":"Vannini","address":"K\u00e4mmererstr. 3","foursquare_id":"4bf94ec05ec320a115f889d3"} +["result",0,"message"] {"message_id":6620,"from":{"id":123456789,"is_bot":false,"first_name":"Kay","last_name":"M","username":"Gnadelwartz","language_code":"de"},"chat":{"id":123456789,"first_name":"Kay","last_name":"M","username":"Gnadelwartz","type":"private"},"date":1555934213,"location":{"latitude":49.630443,"longitude":8.361698},"venue":{"location":{"latitude":49.630443,"longitude":8.361698},"title":"Vannini","address":"K\u00e4mmererstr. 3","foursquare_id":"4bf94ec05ec320a115f889d3"}} +["result",0] {"update_id":146860898,"message":{"message_id":6620,"from":{"id":123456789,"is_bot":false,"first_name":"Kay","last_name":"M","username":"Gnadelwartz","language_code":"de"},"chat":{"id":123456789,"first_name":"Kay","last_name":"M","username":"Gnadelwartz","type":"private"},"date":1555934213,"location":{"latitude":49.630443,"longitude":8.361698},"venue":{"location":{"latitude":49.630443,"longitude":8.361698},"title":"Vannini","address":"K\u00e4mmererstr. 3","foursquare_id":"4bf94ec05ec320a115f889d3"}}} +["result"] [{"update_id":146860898,"message":{"message_id":6620,"from":{"id":123456789,"is_bot":false,"first_name":"Kay","last_name":"M","username":"Gnadelwartz","language_code":"de"},"chat":{"id":123456789,"first_name":"Kay","last_name":"M","username":"Gnadelwartz","type":"private"},"date":1555934213,"location":{"latitude":49.630443,"longitude":8.361698},"venue":{"location":{"latitude":49.630443,"longitude":8.361698},"title":"Vannini","address":"K\u00e4mmererstr. 3","foursquare_id":"4bf94ec05ec320a115f889d3"}}}] +[] {"ok":true,"result":[{"update_id":146860898,"message":{"message_id":6620,"from":{"id":123456789,"is_bot":false,"first_name":"Kay","last_name":"M","username":"Gnadelwartz","language_code":"de"},"chat":{"id":123456789,"first_name":"Kay","last_name":"M","username":"Gnadelwartz","type":"private"},"date":1555934213,"location":{"latitude":49.630443,"longitude":8.361698},"venue":{"location":{"latitude":49.630443,"longitude":8.361698},"title":"Vannini","address":"K\u00e4mmererstr. 3","foursquare_id":"4bf94ec05ec320a115f889d3"}}}]} diff --git a/test/d-JSON.sh-test/JSON30458.log.result-1 b/test/d-JSON.sh-test/JSON30458.log.result-1 new file mode 100644 index 0000000..fa5a210 --- /dev/null +++ b/test/d-JSON.sh-test/JSON30458.log.result-1 @@ -0,0 +1,19 @@ +["ok"] true +["result",0,"update_id"] 146860896 +["result",0,"message","message_id"] 6618 +["result",0,"message","from","id"] 123456789 +["result",0,"message","from","is_bot"] false +["result",0,"message","from","first_name"] "Kay" +["result",0,"message","from","last_name"] "M" +["result",0,"message","from","username"] "Gnadelwartz" +["result",0,"message","from","language_code"] "de" +["result",0,"message","chat","id"] 123456789 +["result",0,"message","chat","first_name"] "Kay" +["result",0,"message","chat","last_name"] "M" +["result",0,"message","chat","username"] "Gnadelwartz" +["result",0,"message","chat","type"] "private" +["result",0,"message","date"] 1555934195 +["result",0,"message","voice","duration"] 1 +["result",0,"message","voice","mime_type"] "audio/ogg" +["result",0,"message","voice","file_id"] "AwADAgADKQMAAh638UnbhHGzIMozZgI" +["result",0,"message","voice","file_size"] 3963 diff --git a/test/d-JSON.sh-test/JSON30458.log.result-2 b/test/d-JSON.sh-test/JSON30458.log.result-2 new file mode 100644 index 0000000..7a26778 --- /dev/null +++ b/test/d-JSON.sh-test/JSON30458.log.result-2 @@ -0,0 +1,26 @@ +["ok"] true +["result",0,"update_id"] 146860896 +["result",0,"message","message_id"] 6618 +["result",0,"message","from","id"] 123456789 +["result",0,"message","from","is_bot"] false +["result",0,"message","from","first_name"] "Kay" +["result",0,"message","from","last_name"] "M" +["result",0,"message","from","username"] "Gnadelwartz" +["result",0,"message","from","language_code"] "de" +["result",0,"message","from"] {"id":123456789,"is_bot":false,"first_name":"Kay","last_name":"M","username":"Gnadelwartz","language_code":"de"} +["result",0,"message","chat","id"] 123456789 +["result",0,"message","chat","first_name"] "Kay" +["result",0,"message","chat","last_name"] "M" +["result",0,"message","chat","username"] "Gnadelwartz" +["result",0,"message","chat","type"] "private" +["result",0,"message","chat"] {"id":123456789,"first_name":"Kay","last_name":"M","username":"Gnadelwartz","type":"private"} +["result",0,"message","date"] 1555934195 +["result",0,"message","voice","duration"] 1 +["result",0,"message","voice","mime_type"] "audio/ogg" +["result",0,"message","voice","file_id"] "AwADAgADKQMAAh638UnbhHGzIMozZgI" +["result",0,"message","voice","file_size"] 3963 +["result",0,"message","voice"] {"duration":1,"mime_type":"audio/ogg","file_id":"AwADAgADKQMAAh638UnbhHGzIMozZgI","file_size":3963} +["result",0,"message"] {"message_id":6618,"from":{"id":123456789,"is_bot":false,"first_name":"Kay","last_name":"M","username":"Gnadelwartz","language_code":"de"},"chat":{"id":123456789,"first_name":"Kay","last_name":"M","username":"Gnadelwartz","type":"private"},"date":1555934195,"voice":{"duration":1,"mime_type":"audio/ogg","file_id":"AwADAgADKQMAAh638UnbhHGzIMozZgI","file_size":3963}} +["result",0] {"update_id":146860896,"message":{"message_id":6618,"from":{"id":123456789,"is_bot":false,"first_name":"Kay","last_name":"M","username":"Gnadelwartz","language_code":"de"},"chat":{"id":123456789,"first_name":"Kay","last_name":"M","username":"Gnadelwartz","type":"private"},"date":1555934195,"voice":{"duration":1,"mime_type":"audio/ogg","file_id":"AwADAgADKQMAAh638UnbhHGzIMozZgI","file_size":3963}}} +["result"] [{"update_id":146860896,"message":{"message_id":6618,"from":{"id":123456789,"is_bot":false,"first_name":"Kay","last_name":"M","username":"Gnadelwartz","language_code":"de"},"chat":{"id":123456789,"first_name":"Kay","last_name":"M","username":"Gnadelwartz","type":"private"},"date":1555934195,"voice":{"duration":1,"mime_type":"audio/ogg","file_id":"AwADAgADKQMAAh638UnbhHGzIMozZgI","file_size":3963}}}] +[] {"ok":true,"result":[{"update_id":146860896,"message":{"message_id":6618,"from":{"id":123456789,"is_bot":false,"first_name":"Kay","last_name":"M","username":"Gnadelwartz","language_code":"de"},"chat":{"id":123456789,"first_name":"Kay","last_name":"M","username":"Gnadelwartz","type":"private"},"date":1555934195,"voice":{"duration":1,"mime_type":"audio/ogg","file_id":"AwADAgADKQMAAh638UnbhHGzIMozZgI","file_size":3963}}}]} diff --git a/test/d-JSON.sh-test/JSON32034.log.result-1 b/test/d-JSON.sh-test/JSON32034.log.result-1 new file mode 100644 index 0000000..8e784c3 --- /dev/null +++ b/test/d-JSON.sh-test/JSON32034.log.result-1 @@ -0,0 +1,18 @@ +["ok"] true +["result",0,"update_id"] 146860897 +["result",0,"message","message_id"] 6619 +["result",0,"message","from","id"] 123456789 +["result",0,"message","from","is_bot"] false +["result",0,"message","from","first_name"] "Kay" +["result",0,"message","from","last_name"] "M" +["result",0,"message","from","username"] "Gnadelwartz" +["result",0,"message","from","language_code"] "de" +["result",0,"message","chat","id"] 586928566 +["result",0,"message","chat","first_name"] "Kay" +["result",0,"message","chat","last_name"] "M" +["result",0,"message","chat","username"] "Gnadelwartz" +["result",0,"message","chat","type"] "private" +["result",0,"message","date"] 1555934204 +["result",0,"message","contact","phone_number"] "222222" +["result",0,"message","contact","first_name"] "ADAC Pannenhilfe" +["result",0,"message","contact","vcard"] "BEGIN:VCARD\nVERSION:2.1\nN:Pannenhilfe;ADAC;;;\nFN:ADAC Pannenhilfe\nTEL;CELL;PREF:+49179222222\nTEL;X-Mobil:222222\nEND:VCARD" diff --git a/test/d-JSON.sh-test/JSON32034.log.result-2 b/test/d-JSON.sh-test/JSON32034.log.result-2 new file mode 100644 index 0000000..eb36337 --- /dev/null +++ b/test/d-JSON.sh-test/JSON32034.log.result-2 @@ -0,0 +1,25 @@ +["ok"] true +["result",0,"update_id"] 146860897 +["result",0,"message","message_id"] 6619 +["result",0,"message","from","id"] 123456789 +["result",0,"message","from","is_bot"] false +["result",0,"message","from","first_name"] "Kay" +["result",0,"message","from","last_name"] "M" +["result",0,"message","from","username"] "Gnadelwartz" +["result",0,"message","from","language_code"] "de" +["result",0,"message","from"] {"id":123456789,"is_bot":false,"first_name":"Kay","last_name":"M","username":"Gnadelwartz","language_code":"de"} +["result",0,"message","chat","id"] 586928566 +["result",0,"message","chat","first_name"] "Kay" +["result",0,"message","chat","last_name"] "M" +["result",0,"message","chat","username"] "Gnadelwartz" +["result",0,"message","chat","type"] "private" +["result",0,"message","chat"] {"id":586928566,"first_name":"Kay","last_name":"M","username":"Gnadelwartz","type":"private"} +["result",0,"message","date"] 1555934204 +["result",0,"message","contact","phone_number"] "222222" +["result",0,"message","contact","first_name"] "ADAC Pannenhilfe" +["result",0,"message","contact","vcard"] "BEGIN:VCARD\nVERSION:2.1\nN:Pannenhilfe;ADAC;;;\nFN:ADAC Pannenhilfe\nTEL;CELL;PREF:+49179222222\nTEL;X-Mobil:222222\nEND:VCARD" +["result",0,"message","contact"] {"phone_number":"222222","first_name":"ADAC Pannenhilfe","vcard":"BEGIN:VCARD\nVERSION:2.1\nN:Pannenhilfe;ADAC;;;\nFN:ADAC Pannenhilfe\nTEL;CELL;PREF:+49179222222\nTEL;X-Mobil:222222\nEND:VCARD"} +["result",0,"message"] {"message_id":6619,"from":{"id":123456789,"is_bot":false,"first_name":"Kay","last_name":"M","username":"Gnadelwartz","language_code":"de"},"chat":{"id":586928566,"first_name":"Kay","last_name":"M","username":"Gnadelwartz","type":"private"},"date":1555934204,"contact":{"phone_number":"222222","first_name":"ADAC Pannenhilfe","vcard":"BEGIN:VCARD\nVERSION:2.1\nN:Pannenhilfe;ADAC;;;\nFN:ADAC Pannenhilfe\nTEL;CELL;PREF:+49179222222\nTEL;X-Mobil:222222\nEND:VCARD"}} +["result",0] {"update_id":146860897,"message":{"message_id":6619,"from":{"id":123456789,"is_bot":false,"first_name":"Kay","last_name":"M","username":"Gnadelwartz","language_code":"de"},"chat":{"id":586928566,"first_name":"Kay","last_name":"M","username":"Gnadelwartz","type":"private"},"date":1555934204,"contact":{"phone_number":"222222","first_name":"ADAC Pannenhilfe","vcard":"BEGIN:VCARD\nVERSION:2.1\nN:Pannenhilfe;ADAC;;;\nFN:ADAC Pannenhilfe\nTEL;CELL;PREF:+49179222222\nTEL;X-Mobil:222222\nEND:VCARD"}}} +["result"] [{"update_id":146860897,"message":{"message_id":6619,"from":{"id":123456789,"is_bot":false,"first_name":"Kay","last_name":"M","username":"Gnadelwartz","language_code":"de"},"chat":{"id":586928566,"first_name":"Kay","last_name":"M","username":"Gnadelwartz","type":"private"},"date":1555934204,"contact":{"phone_number":"222222","first_name":"ADAC Pannenhilfe","vcard":"BEGIN:VCARD\nVERSION:2.1\nN:Pannenhilfe;ADAC;;;\nFN:ADAC Pannenhilfe\nTEL;CELL;PREF:+49179222222\nTEL;X-Mobil:222222\nEND:VCARD"}}}] +[] {"ok":true,"result":[{"update_id":146860897,"message":{"message_id":6619,"from":{"id":123456789,"is_bot":false,"first_name":"Kay","last_name":"M","username":"Gnadelwartz","language_code":"de"},"chat":{"id":586928566,"first_name":"Kay","last_name":"M","username":"Gnadelwartz","type":"private"},"date":1555934204,"contact":{"phone_number":"222222","first_name":"ADAC Pannenhilfe","vcard":"BEGIN:VCARD\nVERSION:2.1\nN:Pannenhilfe;ADAC;;;\nFN:ADAC Pannenhilfe\nTEL;CELL;PREF:+49179222222\nTEL;X-Mobil:222222\nEND:VCARD"}}}]} diff --git a/test/d-process_message-test.sh b/test/d-process_message-test.sh index 5de9895..f068e5b 100755 --- a/test/d-process_message-test.sh +++ b/test/d-process_message-test.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -#### $$VERSION$$ v0.62-0-g5d5dbae +#### $$VERSION$$ v0.70-dev2-0-g4fff4c3 # include common functions and definitions # shellcheck source=test/ALL-tests.inc.sh