mirror of
https://github.com/octoleo/telegram-bot-bash.git
synced 2024-06-03 02:40:52 +00:00
rearrange example and dev files
This commit is contained in:
parent
12fd839e72
commit
a97cd69402
|
@ -99,4 +99,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!
|
If you feel that there's something missing or if you found a bug, feel free to submit a pull request!
|
||||||
|
|
||||||
#### $$VERSION$$ 0.70-dev-2-gebd9e6f
|
#### $$VERSION$$ 0.70-dev-4-g12fd839
|
||||||
|
|
|
@ -161,5 +161,5 @@ That's it!
|
||||||
If you feel that there's something missing or if you found a bug, feel
|
If you feel that there's something missing or if you found a bug, feel
|
||||||
free to submit a pull request!
|
free to submit a pull request!
|
||||||
|
|
||||||
latexmath:[\[VERSION\]] 0.70-dev-2-gebd9e6f
|
latexmath:[\[VERSION\]] 0.70-dev-4-g12fd839
|
||||||
+++++++++++++++++++++++++++++++++++++++++++
|
+++++++++++++++++++++++++++++++++++++++++++
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# description: Start or stop telegram-bash-bot
|
# description: Start or stop telegram-bash-bot
|
||||||
#
|
#
|
||||||
#### $$VERSION$$ 0.70-dev-2-gebd9e6f
|
#### $$VERSION$$ 0.70-dev-4-g12fd839
|
||||||
# shellcheck disable=SC2009
|
# shellcheck disable=SC2009
|
||||||
# shellcheck disable=SC2181
|
# shellcheck disable=SC2181
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
# This file is public domain in the USA and all free countries.
|
# This file is public domain in the USA and all free countries.
|
||||||
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
||||||
#
|
#
|
||||||
#### $$VERSION$$ 0.70-dev-2-gebd9e6f
|
#### $$VERSION$$ 0.70-dev-4-g12fd839
|
||||||
#
|
#
|
||||||
# Exit Codes:
|
# Exit Codes:
|
||||||
# - 0 sucess (hopefully)
|
# - 0 sucess (hopefully)
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
# This file is public domain in the USA and all free countries.
|
# This file is public domain in the USA and all free countries.
|
||||||
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
||||||
#
|
#
|
||||||
#### $$VERSION$$ 0.70-dev-2-gebd9e6f
|
#### $$VERSION$$ 0.70-dev-4-g12fd839
|
||||||
#
|
#
|
||||||
# shellcheck disable=SC2154
|
# shellcheck disable=SC2154
|
||||||
# shellcheck disable=SC2034
|
# shellcheck disable=SC2034
|
||||||
|
@ -100,7 +100,7 @@ else
|
||||||
'/question')
|
'/question')
|
||||||
checkproc
|
checkproc
|
||||||
if [ "$res" -gt 0 ] ; then
|
if [ "$res" -gt 0 ] ; then
|
||||||
startproc "./question"
|
startproc "example/question"
|
||||||
else
|
else
|
||||||
send_normal_message "${CHAT[ID]}" "$MESSAGE already running ..."
|
send_normal_message "${CHAT[ID]}" "$MESSAGE already running ..."
|
||||||
fi
|
fi
|
||||||
|
@ -109,7 +109,7 @@ else
|
||||||
'/run-notify')
|
'/run-notify')
|
||||||
myback="notify"; checkback "$myback"
|
myback="notify"; checkback "$myback"
|
||||||
if [ "$res" -gt 0 ] ; then
|
if [ "$res" -gt 0 ] ; then
|
||||||
background "./notify 60" "$myback" # notify every 60 seconds
|
background "example/notify 60" "$myback" # notify every 60 seconds
|
||||||
else
|
else
|
||||||
send_normal_message "${CHAT[ID]}" "Background command $myback already running ..."
|
send_normal_message "${CHAT[ID]}" "Background command $myback already running ..."
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -8,13 +8,15 @@
|
||||||
GIT_DIR=$(git rev-parse --git-dir)
|
GIT_DIR=$(git rev-parse --git-dir)
|
||||||
cd "$GIT_DIR/.." || exit 1
|
cd "$GIT_DIR/.." || exit 1
|
||||||
|
|
||||||
|
HOOKDIR="dev/hooks"
|
||||||
|
|
||||||
echo -n "Installing hooks..."
|
echo -n "Installing hooks..."
|
||||||
for hook in pre-commit pre-push
|
for hook in pre-commit pre-push
|
||||||
do
|
do
|
||||||
rm -f "$GIT_DIR/hooks/${hook}"
|
rm -f ".git/hooks/${hook}"
|
||||||
if [ -f "hooks/${hook}.sh" ]; then
|
if [ -f "${HOOKDIR}/${hook}.sh" ]; then
|
||||||
echo -n " $hook"
|
echo -n " $hook"
|
||||||
ln -s "../../hooks/${hook}.sh" "$GIT_DIR/hooks/${hook}"
|
ln -s "../../${HOOKDIR}/${hook}.sh" "${GIT_DIR}/hooks/${hook}"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
echo " Done!"
|
echo " Done!"
|
|
@ -6,6 +6,8 @@
|
||||||
GIT_DIR=$(git rev-parse --git-dir)
|
GIT_DIR=$(git rev-parse --git-dir)
|
||||||
cd "$GIT_DIR/.." || exit 1
|
cd "$GIT_DIR/.." || exit 1
|
||||||
|
|
||||||
|
HOOKDIR="dev/hooks"
|
||||||
|
|
||||||
echo "Running pre-commit hook"
|
echo "Running pre-commit hook"
|
||||||
|
|
||||||
# if any command inside script returns error, exit and return that error
|
# if any command inside script returns error, exit and return that error
|
||||||
|
@ -26,7 +28,7 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# run shellcheck before commit
|
# run shellcheck before commit
|
||||||
FILES=$(sed '/^#/d' <"hooks/shellcheck.files")
|
FILES=$(sed '/^#/d' <"${HOOKDIR}/shellcheck.files")
|
||||||
if [ "$FILES" != "" ]; then
|
if [ "$FILES" != "" ]; then
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
shellcheck -x ${FILES} || exit 1
|
shellcheck -x ${FILES} || exit 1
|
|
@ -5,6 +5,9 @@
|
||||||
# no matter from which directory we'll run script
|
# no matter from which directory we'll run script
|
||||||
GIT_DIR=$(git rev-parse --git-dir)
|
GIT_DIR=$(git rev-parse --git-dir)
|
||||||
cd "$GIT_DIR/.." || exit 1
|
cd "$GIT_DIR/.." || exit 1
|
||||||
|
|
||||||
|
HOOKDIR="dev/hooks"
|
||||||
|
|
||||||
REMOTEVER="$(git ls-remote -t --refs 2>/dev/null | tail -1 | sed 's/.*\/v//')"
|
REMOTEVER="$(git ls-remote -t --refs 2>/dev/null | tail -1 | sed 's/.*\/v//')"
|
||||||
VERSION="$(git describe --tags | sed -e 's/-.*//' -e 's/v//')"
|
VERSION="$(git describe --tags | sed -e 's/-.*//' -e 's/v//')"
|
||||||
|
|
||||||
|
@ -22,7 +25,7 @@ unset IFS; set -f
|
||||||
# LOCAL version must greater than latest REMOTE release version
|
# LOCAL version must greater than latest REMOTE release version
|
||||||
if (( $(echo "${VERSION} > ${REMOTEVER}" | bc -l) )); then
|
if (( $(echo "${VERSION} > ${REMOTEVER}" | bc -l) )); then
|
||||||
# update version in bashbot files on push
|
# update version in bashbot files on push
|
||||||
./version
|
dev/version.sh 2>/dev/null
|
||||||
else
|
else
|
||||||
echo "Error: local version ${VERSION} must be greater than latest release version."
|
echo "Error: local version ${VERSION} must be greater than latest release version."
|
||||||
echo "use \"git tag ...\" to create a local version greater than ${REMOTEVER}"
|
echo "use \"git tag ...\" to create a local version greater than ${REMOTEVER}"
|
14
dev/hooks/shellcheck.files
Normal file
14
dev/hooks/shellcheck.files
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
# list of files to run shellscheck against
|
||||||
|
#### $$VERSION$$ 0.70-dev-0-g209c4b3
|
||||||
|
# main files
|
||||||
|
bashbot.sh
|
||||||
|
commands.sh
|
||||||
|
bashbot.rc
|
||||||
|
# example files
|
||||||
|
examples/calc
|
||||||
|
examples/notify
|
||||||
|
examples/question
|
||||||
|
# dev files
|
||||||
|
dev/version.sh
|
||||||
|
dev/hooks/install-hooks.sh
|
||||||
|
dev/hooks/pre-commit.sh
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
#
|
#
|
||||||
#### $$VERSION$$ 0.70-dev-2-gebd9e6f
|
#### $$VERSION$$ 0.70-dev-4-g12fd839
|
||||||
# shellcheck disable=SC2016
|
# shellcheck disable=SC2016
|
||||||
#
|
#
|
||||||
# Easy Versioning in git:
|
# Easy Versioning in git:
|
||||||
|
@ -34,11 +34,16 @@
|
||||||
# run this script to (re)place Version number in files
|
# run this script to (re)place Version number in files
|
||||||
#
|
#
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
unset IFS
|
unset IFS
|
||||||
# set -f # if you are paranoid use set -f to disable globbing
|
# set -f # if you are paranoid use set -f to disable globbing
|
||||||
|
|
||||||
VERSION="$(git describe --tags --long)"
|
VERSION="$(git describe --tags --long)"
|
||||||
echo "Update files to version $VERSION ..."
|
echo "Update to version $VERSION ..."
|
||||||
|
|
||||||
FILES="* doc/* test/*"
|
FILES="* doc/* test/*"
|
||||||
[ "$1" != "" ] && FILES="$*"
|
[ "$1" != "" ] && FILES="$*"
|
||||||
|
@ -47,11 +52,11 @@ for file in $FILES
|
||||||
do
|
do
|
||||||
[ ! -f "$file" ] && continue
|
[ ! -f "$file" ] && continue
|
||||||
#[ "$file" == "version" ] && continue
|
#[ "$file" == "version" ] && continue
|
||||||
echo -n " $file"
|
echo -n " $file" >&2
|
||||||
sed -i 's/^#### $$VERSION$$.*/#### \$\$VERSION\$\$ '"$VERSION"'/' "$file"
|
sed -i 's/^#### $$VERSION$$.*/#### \$\$VERSION\$\$ '"$VERSION"'/' "$file"
|
||||||
done
|
done
|
||||||
# try to compile README.txt
|
# try to compile README.txt
|
||||||
echo -n " README.txt"
|
echo -n " README.txt" >&2
|
||||||
pandoc -f markdown -t asciidoc README.md | sed '/^\[\[/d' >README.txt
|
pandoc -f markdown -t asciidoc README.md | sed '/^\[\[/d' >README.txt
|
||||||
echo " done."
|
echo " done."
|
||||||
|
|
|
@ -61,5 +61,5 @@ group. This step is up to you actually.
|
||||||
|
|
||||||
#### [Next Getting started](2_usage.md)
|
#### [Next Getting started](2_usage.md)
|
||||||
|
|
||||||
#### $$VERSION$$ 0.70-dev-2-gebd9e6f
|
#### $$VERSION$$ 0.70-dev-4-g12fd839
|
||||||
|
|
||||||
|
|
|
@ -159,5 +159,5 @@ send_action "${CHAT[ID]}" "action"
|
||||||
#### [Prev Create Bot](1_firstbot.md)
|
#### [Prev Create Bot](1_firstbot.md)
|
||||||
#### [Next Advanced Usage](3_advanced.md)
|
#### [Next Advanced Usage](3_advanced.md)
|
||||||
|
|
||||||
#### $$VERSION$$ 0.70-dev-2-gebd9e6f
|
#### $$VERSION$$ 0.70-dev-4-g12fd839
|
||||||
|
|
||||||
|
|
|
@ -156,5 +156,5 @@ answer_inline_query "$iQUERY_ID" "cached_sticker" "identifier for the sticker"
|
||||||
#### [Prev Advanced Usage](3_advanced.md)
|
#### [Prev Advanced Usage](3_advanced.md)
|
||||||
#### [Next Expert Use](4_expert.md)
|
#### [Next Expert Use](4_expert.md)
|
||||||
|
|
||||||
#### $$VERSION$$ 0.70-dev-2-gebd9e6f
|
#### $$VERSION$$ 0.70-dev-4-g12fd839
|
||||||
|
|
||||||
|
|
|
@ -104,5 +104,5 @@ An example crontab is provided in ```bashbot.cron```.
|
||||||
#### [Prev Expert Use](4_expert.md)
|
#### [Prev Expert Use](4_expert.md)
|
||||||
#### [Next Best Practice](5_practice.md)
|
#### [Next Best Practice](5_practice.md)
|
||||||
|
|
||||||
#### $$VERSION$$ 0.70-dev-2-gebd9e6f
|
#### $$VERSION$$ 0.70-dev-4-g12fd839
|
||||||
|
|
||||||
|
|
|
@ -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)
|
#### [Prev Best Practice](5_practice.md)
|
||||||
#### [Next Functions Reference](6_reference.md)
|
#### [Next Functions Reference](6_reference.md)
|
||||||
|
|
||||||
#### $$VERSION$$ 0.70-dev-2-gebd9e6f
|
#### $$VERSION$$ 0.70-dev-4-g12fd839
|
||||||
|
|
||||||
|
|
|
@ -347,5 +347,5 @@ Send Input from Telegram to waiting Interactive Chat.
|
||||||
|
|
||||||
#### [Prev Best Practice](5_practice.md)
|
#### [Prev Best Practice](5_practice.md)
|
||||||
|
|
||||||
#### $$VERSION$$ 0.70-dev-2-gebd9e6f
|
#### $$VERSION$$ 0.70-dev-4-g12fd839
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
# This file is public domain in the USA and all free countries.
|
# This file is public domain in the USA and all free countries.
|
||||||
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
||||||
#
|
#
|
||||||
#### $$VERSION$$ 0.70-dev-2-gebd9e6f
|
#### $$VERSION$$ 0.70-dev-4-g12fd839
|
||||||
|
|
||||||
|
|
||||||
SHELL=/bin/sh
|
SHELL=/bin/sh
|
|
@ -3,7 +3,7 @@
|
||||||
# This file is public domain in the USA and all free countries.
|
# This file is public domain in the USA and all free countries.
|
||||||
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
||||||
|
|
||||||
#### $$VERSION$$ 0.70-dev-2-gebd9e6f
|
#### $$VERSION$$ 0.70-dev-4-g12fd839
|
||||||
|
|
||||||
# adjust your language setting here
|
# adjust your language setting here
|
||||||
# https://github.com/topkecleon/telegram-bot-bash#setting-up-your-environment
|
# 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.
|
# This file is public domain in the USA and all free countries.
|
||||||
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
||||||
#### $$VERSION$$ 0.70-dev-2-gebd9e6f
|
#### $$VERSION$$ 0.70-dev-4-g12fd839
|
||||||
|
|
||||||
# adjust your language setting here
|
# adjust your language setting here
|
||||||
# https://github.com/topkecleon/telegram-bot-bash#setting-up-your-environment
|
# 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.
|
# This file is public domain in the USA and all free countries.
|
||||||
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
||||||
|
|
||||||
#### $$VERSION$$ 0.70-dev-2-gebd9e6f
|
#### $$VERSION$$ 0.70-dev-4-g12fd839
|
||||||
|
|
||||||
# adjust your language setting here
|
# adjust your language setting here
|
||||||
# https://github.com/topkecleon/telegram-bot-bash#setting-up-your-environment
|
# https://github.com/topkecleon/telegram-bot-bash#setting-up-your-environment
|
|
@ -1,14 +0,0 @@
|
||||||
# list of files to run shellscheck against
|
|
||||||
#### $$VERSION$$ 0.70-dev-0-g209c4b3
|
|
||||||
# main files
|
|
||||||
bashbot.rc
|
|
||||||
bashbot.sh
|
|
||||||
version
|
|
||||||
# job files
|
|
||||||
calc
|
|
||||||
commands.sh
|
|
||||||
notify
|
|
||||||
question
|
|
||||||
# test files
|
|
||||||
hooks/install-hooks.sh
|
|
||||||
hooks/pre-commit.sh
|
|
Loading…
Reference in New Issue
Block a user