mirror of
https://github.com/octoleo/telegram-bot-bash.git
synced 2024-06-01 09:50:53 +00:00
dev version 0.7 starts
This commit is contained in:
parent
3fb7796c99
commit
ef0041e7bd
|
@ -51,6 +51,7 @@ Bashbot [Documentation](https://github.com/topkecleon/telegram-bot-bash) and [Do
|
||||||
* Seperate logic from commands
|
* Seperate logic from commands
|
||||||
* Test your Bot with shellcheck
|
* Test your Bot with shellcheck
|
||||||
* [Bashbot function reference](doc/6_reference.md)
|
* [Bashbot function reference](doc/6_reference.md)
|
||||||
|
* [Notes for bashbot developers](doc/7_develop.md)
|
||||||
|
|
||||||
## Note on Keyboards
|
## Note on Keyboards
|
||||||
From Version 0.60 on keybord format for ```send_keyboard``` and ```send_message "mykeyboardstartshere ..."``` was changed.
|
From Version 0.60 on keybord format for ```send_keyboard``` and ```send_message "mykeyboardstartshere ..."``` was changed.
|
||||||
|
@ -98,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-5-ga97cd69
|
#### $$VERSION$$ 0.70-dev-6-g3fb7796
|
||||||
|
|
19
README.txt
19
README.txt
|
@ -30,14 +30,14 @@ Install bashbot
|
||||||
1. Go to the directory you want to install bashbot, e.g.
|
1. Go to the directory you want to install bashbot, e.g.
|
||||||
* your $HOME directory (install and run with your user-ID)
|
* your $HOME directory (install and run with your user-ID)
|
||||||
* /usr/local if you want to run as service
|
* /usr/local if you want to run as service
|
||||||
2. Clone the repository:
|
2. https://github.com/topkecleon/telegram-bot-bash/releases[Download
|
||||||
+
|
latest release archive from github] and unpack it.
|
||||||
....
|
|
||||||
git clone --recursive https://github.com/topkecleon/telegram-bot-bash
|
If you want the current version from github, clone the repository:
|
||||||
....
|
`git clone https://github.com/topkecleon/telegram-bot-bash` 3. Change
|
||||||
3. Change to directory `telegram-bot-bash`, run `./bashbot.sh init` and
|
directory to `telegram-bot-bash` and run `./bashbot.sh init`. Now follow
|
||||||
follow the instructions. At this stage you are asked for your Bots token
|
the instructions. At one point you are asked for your Bots token given
|
||||||
given by botfather.
|
by botfather.
|
||||||
|
|
||||||
Update bashbot
|
Update bashbot
|
||||||
~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~
|
||||||
|
@ -71,6 +71,7 @@ Documentation
|
||||||
** Seperate logic from commands
|
** Seperate logic from commands
|
||||||
** Test your Bot with shellcheck
|
** Test your Bot with shellcheck
|
||||||
* link:doc/6_reference.md[Bashbot function reference]
|
* link:doc/6_reference.md[Bashbot function reference]
|
||||||
|
* link:doc/7_develop.md[Notes for bashbot developers]
|
||||||
|
|
||||||
Note on Keyboards
|
Note on Keyboards
|
||||||
~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~
|
||||||
|
@ -161,5 +162,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-4-g12fd839
|
latexmath:[\[VERSION\]] 0.70-dev-6-g3fb7796
|
||||||
+++++++++++++++++++++++++++++++++++++++++++
|
+++++++++++++++++++++++++++++++++++++++++++
|
||||||
|
|
|
@ -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-4-g12fd839
|
#### $$VERSION$$ 0.70-dev-6-g3fb7796
|
||||||
# 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-5-ga97cd69
|
#### $$VERSION$$ 0.70-dev-6-g3fb7796
|
||||||
#
|
#
|
||||||
# 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-4-g12fd839
|
#### $$VERSION$$ 0.70-dev-6-g3fb7796
|
||||||
#
|
#
|
||||||
# shellcheck disable=SC2154
|
# shellcheck disable=SC2154
|
||||||
# shellcheck disable=SC2034
|
# shellcheck disable=SC2034
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
#### $$VERSION$$ 0.70-dev-0-g209c4b3
|
#### $$VERSION$$ 0.70-dev-6-g3fb7796
|
||||||
|
|
||||||
# magic to ensure that we're always inside the root of our application,
|
# magic to ensure that we're always inside the root of our application,
|
||||||
# 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"
|
export HOOKDIR="dev/hooks"
|
||||||
|
|
||||||
echo "Running pre-commit hook"
|
echo "Running pre-commit hook"
|
||||||
|
|
||||||
|
@ -28,6 +28,7 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# run shellcheck before commit
|
# run shellcheck before commit
|
||||||
|
echo "read files from ${HOOKDIR}/shellcheck.files ..."
|
||||||
FILES=$(sed '/^#/d' <"${HOOKDIR}/shellcheck.files")
|
FILES=$(sed '/^#/d' <"${HOOKDIR}/shellcheck.files")
|
||||||
if [ "$FILES" != "" ]; then
|
if [ "$FILES" != "" ]; then
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
#### $$VERSION$$ 0.70-dev-0-g209c4b3
|
#### $$VERSION$$ 0.70-dev-6-g3fb7796
|
||||||
|
|
||||||
# magic to ensure that we're always inside the root of our application,
|
# magic to ensure that we're always inside the root of our application,
|
||||||
# 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"
|
export 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//')"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# list of files to run shellscheck against
|
# list of files to run shellscheck against
|
||||||
#### $$VERSION$$ 0.70-dev-0-g209c4b3
|
#### $$VERSION$$ 0.70-dev-6-g3fb7796
|
||||||
# main files
|
# main files
|
||||||
bashbot.sh
|
bashbot.sh
|
||||||
commands.sh
|
commands.sh
|
||||||
|
@ -10,5 +10,6 @@ examples/notify
|
||||||
examples/question
|
examples/question
|
||||||
# dev files
|
# dev files
|
||||||
dev/version.sh
|
dev/version.sh
|
||||||
dev/hooks/install-hooks.sh
|
dev/install-hooks.sh
|
||||||
dev/hooks/pre-commit.sh
|
dev/hooks/pre-commit.sh
|
||||||
|
dev/hooks/pre-push.sh
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# this has to run once atfer git clone
|
# this has to run once atfer git clone
|
||||||
# and every time we create new hooks
|
# and every time we create new hooks
|
||||||
#### $$VERSION$$ 0.70-dev-0-g209c4b3
|
#### $$VERSION$$ 0.70-dev-6-g3fb7796
|
||||||
|
|
||||||
# magic to ensure that we're always inside the root of our application,
|
# magic to ensure that we're always inside the root of our application,
|
||||||
# no matter from which directory we'll run script
|
# no matter from which directory we'll run script
|
||||||
|
@ -13,7 +13,7 @@ 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/hooks/${hook}"
|
rm -f "${GIT_DIR}/hooks/${hook}"
|
||||||
if [ -f "${HOOKDIR}/${hook}.sh" ]; then
|
if [ -f "${HOOKDIR}/${hook}.sh" ]; then
|
||||||
echo -n " $hook"
|
echo -n " $hook"
|
||||||
ln -s "../../${HOOKDIR}/${hook}.sh" "${GIT_DIR}/hooks/${hook}"
|
ln -s "../../${HOOKDIR}/${hook}.sh" "${GIT_DIR}/hooks/${hook}"
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
#
|
#
|
||||||
#### $$VERSION$$ 0.70-dev-4-g12fd839
|
#### $$VERSION$$ 0.70-dev-6-g3fb7796
|
||||||
# shellcheck disable=SC2016
|
# shellcheck disable=SC2016
|
||||||
#
|
#
|
||||||
# Easy Versioning in git:
|
# Easy Versioning in git:
|
||||||
|
@ -45,7 +45,7 @@ unset IFS
|
||||||
VERSION="$(git describe --tags --long)"
|
VERSION="$(git describe --tags --long)"
|
||||||
echo "Update to version $VERSION ..."
|
echo "Update to version $VERSION ..."
|
||||||
|
|
||||||
FILES="* doc/* test/*"
|
FILES="* doc/* dev/* dev/*/*"
|
||||||
[ "$1" != "" ] && FILES="$*"
|
[ "$1" != "" ] && FILES="$*"
|
||||||
|
|
||||||
for file in $FILES
|
for file in $FILES
|
||||||
|
|
|
@ -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-5-ga97cd69
|
#### $$VERSION$$ 0.70-dev-6-g3fb7796
|
||||||
|
|
||||||
|
|
|
@ -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-5-ga97cd69
|
#### $$VERSION$$ 0.70-dev-6-g3fb7796
|
||||||
|
|
||||||
|
|
|
@ -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-5-ga97cd69
|
#### $$VERSION$$ 0.70-dev-6-g3fb7796
|
||||||
|
|
||||||
|
|
|
@ -104,5 +104,5 @@ An example crontab is provided in ```examples/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-5-ga97cd69
|
#### $$VERSION$$ 0.70-dev-6-g3fb7796
|
||||||
|
|
||||||
|
|
|
@ -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-5-ga97cd69
|
#### $$VERSION$$ 0.70-dev-6-g3fb7796
|
||||||
|
|
||||||
|
|
|
@ -346,6 +346,7 @@ The name of your bot is availible as bash variable "$ME", there is no need to ca
|
||||||
Send Input from Telegram to waiting Interactive Chat.
|
Send Input from Telegram to waiting Interactive Chat.
|
||||||
|
|
||||||
#### [Prev Best Practice](5_practice.md)
|
#### [Prev Best Practice](5_practice.md)
|
||||||
|
#### [Next Developer Rules](7_develop.md)
|
||||||
|
|
||||||
#### $$VERSION$$ 0.70-dev-5-ga97cd69
|
#### $$VERSION$$ 0.70-dev-6-g3fb7796
|
||||||
|
|
||||||
|
|
37
doc/7_develop.md
Normal file
37
doc/7_develop.md
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
#### [Home](../README.md)
|
||||||
|
## Notes for bashbot developers
|
||||||
|
This section is about help and best pratices for new bashbot developers. The main focus on creating new versions of bashbot, not on develop an individual bot. Nevertheless rules and tools described can also applied to your bot development.
|
||||||
|
|
||||||
|
Bashbot development is done on gitbub. If you want to provide fixes or new features fork bashbot on githup and provide changes as pull request.
|
||||||
|
|
||||||
|
### Setup your develop environment
|
||||||
|
|
||||||
|
1. install git, install [shellcheck](5_practice.md#Test-your-Bot-with-shellcheck)
|
||||||
|
2. setup your [environment for UTF-8](4_expert.md#Setting-up-your-Environment)
|
||||||
|
3. clone your bashbot fork to a new directory ```git clone https://github.com/<YOURNAME>/telegram-bot-bash.git```, replace <YOURNAME> with your username on github
|
||||||
|
4. create and change to your develop branch ```git checkout -b <YOURBRANCH>```, replace <YOURBRANCH> with the name you want to name it, e.g. 'develop'
|
||||||
|
5. give your (dev) fork a new version tag: ```git tag vx.xx```, version must be higher than current version
|
||||||
|
6. setup github hooks by running ```dev/install-hooks.sh``` (optional)
|
||||||
|
|
||||||
|
### Versioning
|
||||||
|
|
||||||
|
Bashbot is tagged with version numbers. If you start new development you must tag your fork with a new version higher than the current version.
|
||||||
|
If you fork 'v0.60' the next develop version should tagged as e.g. ```git tag "v0.61-dev"``` for fixes or ```git tag "v0.70-dev"``` for new features.
|
||||||
|
|
||||||
|
To get the current version name of your dev fork run ```git describe --tags```. The output will something like '0.70-dev-6-g3fb7796', where your version tag is followed by the number of commits since you tag your version and the latest commit hash. see also [comments in version.sh](../dev/version.sh)
|
||||||
|
|
||||||
|
To update the Version Number in your scripts run ```dev/version.sh```, it will update the line '#### $$VERSION$$ ###' in all files to the current version name.
|
||||||
|
|
||||||
|
If you actived git hooks in Setup step 6, 'version.sh' updates the version name on every push
|
||||||
|
|
||||||
|
### Shellchecking
|
||||||
|
|
||||||
|
For a shell script running as a service it's important to be paranoid about quoting, globbing and ohter common problems. So it's a must to run shellchek on all shell scripts before you commit a change. this is done by a git hook activated in Setup step 6.
|
||||||
|
|
||||||
|
You can run shellcheck manually on every file or run ```dev/hooks/pre-commit.sh``` to run shellcheck for all files given in 'dev/hooks/shellcheck.files'.
|
||||||
|
|
||||||
|
|
||||||
|
#### [Prev Function Reference](6_function.md)
|
||||||
|
|
||||||
|
#### $$VERSION$$ 0.70-dev-6-g3fb7796
|
||||||
|
|
Loading…
Reference in New Issue
Block a user