add backward compatibility for keyboards from interactive chats

This commit is contained in:
Kay Marquardt (Gnadelwartz) 2019-04-16 21:56:46 +02:00
parent 2e3c9753fe
commit 19a0f7eac3
4 changed files with 37 additions and 29 deletions

View File

@ -1,21 +1,20 @@
# bashbot # bashbot
A Telegram bot written in bash. A Telegram bot written in bash.
Depends on [tmux](http://github.com/tmux/tmux).
Uses [JSON.sh](http://github.com/dominictarr/JSON.sh).
For full UTF-8 support you need [python on your system](doc/4_expert.md#UTF-8-Support) (optional).
Written by Drew (@topkecleon), Daniil Gentili (@danogentili), and Kay M (@gnadelwartz). Written by Drew (@topkecleon), Daniil Gentili (@danogentili), and Kay M (@gnadelwartz).
Contributions by JuanPotato, BigNerd95, TiagoDanin, and iicc1. Contributions by JuanPotato, BigNerd95, TiagoDanin, and iicc1.
Bashbot [Documentation](https://github.com/topkecleon/telegram-bot-bash) and [Downloads](https://github.com/topkecleon/telegram-bot-bash/releases) are availible on Githup.
Released to the public domain wherever applicable. Released to the public domain wherever applicable.
Elsewhere, consider it released under the [WTFPLv2](http://www.wtfpl.net/txt/copying/). Elsewhere, consider it released under the [WTFPLv2](http://www.wtfpl.net/txt/copying/).
## Prerequsites
Depends on [tmux](http://github.com/tmux/tmux).
Uses [JSON.sh](http://github.com/dominictarr/JSON.sh).
For full UTF-8 support you need [python on your system](doc/4_expert.md#UTF-8-Support) (optional).
Bashbot [Documentation](https://github.com/topkecleon/telegram-bot-bash) and [Downloads](https://github.com/topkecleon/telegram-bot-bash/releases) are availible on www.github.com
## Install bashbot ## 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.
@ -28,7 +27,9 @@ Elsewhere, consider it released under the [WTFPLv2](http://www.wtfpl.net/txt/cop
3. Change to directory ```telegram-bot.bash```, run ```./bashbot.sh init``` and follow the instructions. At this stage you are asked for your Bots token given by botfather. 3. Change to directory ```telegram-bot.bash```, run ```./bashbot.sh init``` and follow the instructions. At this stage you are asked for your Bots token given by botfather.
## Update bashbot ## Update bashbot
[Download latest update zip from github](https://github.com/topkecleon/telegram-bot-bash/releases), extract all files and copy them to your bashbot dir. Now run ```sudo ./bashbot.sh init``` to setup your environment for the new release. 1. [Download latest update zip from github](https://github.com/topkecleon/telegram-bot-bash/releases)
2. Extract all files and copy them to your bashbot dir
3. Run ```sudo ./bashbot.sh init``` to setup your environment after the update-
## Bashbot Documentation ## Bashbot Documentation
* [Create a new Telegram Bot with botfather](doc/1_firstbot.md) * [Create a new Telegram Bot with botfather](doc/1_firstbot.md)
@ -87,7 +88,7 @@ For the same reason ervery file your Bot can read is in danger to be disclosed.
Everyone with read access to your Bot files can extract your Bots data. Especially your Bot Token in ```token``` must be protected against other users. No one exept you must have write access to the Bot files. The Bot must be restricted to have write access to ```count``` and ```tmp-bot-bash``` only, all other files must be write protected. Everyone with read access to your Bot files can extract your Bots data. Especially your Bot Token in ```token``` must be protected against other users. No one exept you must have write access to the Bot files. The Bot must be restricted to have write access to ```count``` and ```tmp-bot-bash``` only, all other files must be write protected.
To set access rights for your bashbot directory to a reasonable default you must run ```sudo ./bashbot.sh init``` after every update or change to your installation directory. To set access rights for your bashbot installation to a reasonable default run ```sudo ./bashbot.sh init``` after every update or change to your installation directory.
### Is this Bot insecure? ### Is this Bot insecure?
Bashbot is not more (in)secure as any other Bot written in any other language, we have done our best to make it as secure as possible. But YOU are responsible for the bot commands you wrote and you should know about the risks ... Bashbot is not more (in)secure as any other Bot written in any other language, we have done our best to make it as secure as possible. But YOU are responsible for the bot commands you wrote and you should know about the risks ...
@ -96,4 +97,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$$ v0.60-rc2-5-g591c583 #### $$VERSION$$ v0.60-rc2-6-g2e3c975

View File

@ -3,23 +3,26 @@ bashbot
A Telegram bot written in bash. A Telegram bot written in bash.
Written by Drew (@topkecleon), Daniil Gentili (@danogentili), and Kay M
(@gnadelwartz).
Contributions by JuanPotato, BigNerd95, TiagoDanin, and iicc1.
Released to the public domain wherever applicable. Elsewhere, consider
it released under the http://www.wtfpl.net/txt/copying/[WTFPLv2].
Prerequsites
~~~~~~~~~~~~
Depends on http://github.com/tmux/tmux[tmux]. Uses Depends on http://github.com/tmux/tmux[tmux]. Uses
http://github.com/dominictarr/JSON.sh[JSON.sh]. http://github.com/dominictarr/JSON.sh[JSON.sh].
For full UTF-8 support you need For full UTF-8 support you need
link:doc/4_expert.md#UTF-8-Support[python on your system] (optional). link:doc/4_expert.md#UTF-8-Support[python on your system] (optional).
Written by Drew (@topkecleon), Daniil Gentili (@danogentili), and Kay M
(@gnadelwartz).
Contributions by JuanPotato, BigNerd95, TiagoDanin, and iicc1.
Bashbot https://github.com/topkecleon/telegram-bot-bash[Documentation] Bashbot https://github.com/topkecleon/telegram-bot-bash[Documentation]
and https://github.com/topkecleon/telegram-bot-bash/releases[Downloads] and https://github.com/topkecleon/telegram-bot-bash/releases[Downloads]
are availible on Githup. are availible on www.github.com
Released to the public domain wherever applicable. Elsewhere, consider
it released under the http://www.wtfpl.net/txt/copying/[WTFPLv2].
Install bashbot Install bashbot
~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~
@ -39,10 +42,11 @@ given by botfather.
Update bashbot Update bashbot
~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~
https://github.com/topkecleon/telegram-bot-bash/releases[Download latest 1. https://github.com/topkecleon/telegram-bot-bash/releases[Download
update zip from github], extract all files and copy them to your bashbot latest update zip from github]
dir. Now run `sudo ./bashbot.sh init` to setup your environment for the 2. Extract all files and copy them to your bashbot dir
new release. 3. Run `sudo ./bashbot.sh init` to setup your environment after the
update-
Bashbot Documentation Bashbot Documentation
~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~
@ -137,8 +141,8 @@ users. No one exept you must have write access to the Bot files. The Bot
must be restricted to have write access to `count` and `tmp-bot-bash` must be restricted to have write access to `count` and `tmp-bot-bash`
only, all other files must be write protected. only, all other files must be write protected.
To set access rights for your bashbot directory to a reasonable default To set access rights for your bashbot installation to a reasonable
you must run `sudo ./bashbot.sh init` after every update or change to default run `sudo ./bashbot.sh init` after every update or change to
your installation directory. your installation directory.
Is this Bot insecure? Is this Bot insecure?
@ -155,5 +159,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\]] v0.60-rc2-5-g591c583 latexmath:[\[VERSION\]] v0.60-rc2-6-g2e3c975
++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++

View File

@ -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$$ v0.60-rc2-5-g591c583 #### $$VERSION$$ v0.60-rc2-6-g2e3c975
# #
# Exit Codes: # Exit Codes:
# - 0 sucess (hopefully) # - 0 sucess (hopefully)
@ -176,11 +176,14 @@ send_message() {
sent=y sent=y
fi fi
if [ "$keyboard" != "" ]; then if [ "$keyboard" != "" ]; then
if [[ "$keyboard" != *"["* ]]; then # pre 0.60 style
keyboard="[ ${keyboard//\" \"/\" , \"} ]"
fi
send_keyboard "$chat" "$text" "$keyboard" send_keyboard "$chat" "$text" "$keyboard"
sent=y sent=y
fi fi
if [ "$file" != "" ]; then if [ "$file" != "" ]; then
send_file "$chat" "$file" "" send_file "$chat" "$file" "$text"
sent=y sent=y
fi fi
if [ "$lat" != "" ] && [ "$long" != "" ] && [ "$address" = "" ] && [ "$title" = "" ]; then if [ "$lat" != "" ] && [ "$long" != "" ] && [ "$address" = "" ] && [ "$title" = "" ]; then

View File

@ -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$$ v0.60-rc2-5-g591c583 #### $$VERSION$$ v0.60-rc2-6-g2e3c975
# 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