mirror of
https://github.com/octoleo/telegram-bot-bash.git
synced 2024-12-28 12:50:44 +00:00
Version 0.60-rc3
This commit is contained in:
parent
19a0f7eac3
commit
f5162e2616
14
README.md
14
README.md
@ -8,7 +8,7 @@ Contributions by JuanPotato, BigNerd95, TiagoDanin, and iicc1.
|
||||
Released to the public domain wherever applicable.
|
||||
Elsewhere, consider it released under the [WTFPLv2](http://www.wtfpl.net/txt/copying/).
|
||||
|
||||
## Prerequsites
|
||||
## Prerequisites
|
||||
Depends on [tmux](http://github.com/tmux/tmux).
|
||||
Uses [JSON.sh](http://github.com/dominictarr/JSON.sh).
|
||||
|
||||
@ -24,14 +24,14 @@ Bashbot [Documentation](https://github.com/topkecleon/telegram-bot-bash) and [Do
|
||||
```
|
||||
git clone --recursive https://github.com/topkecleon/telegram-bot-bash
|
||||
```
|
||||
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
|
||||
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-
|
||||
3. Run ```sudo ./bashbot.sh init``` to setup your environment after the update
|
||||
|
||||
## Bashbot Documentation
|
||||
## Documentation
|
||||
* [Create a new Telegram Bot with botfather](doc/1_firstbot.md)
|
||||
* [Getting Started](doc/2_usage.md)
|
||||
* Managing your Bot
|
||||
@ -57,13 +57,13 @@ Bashbot [Documentation](https://github.com/topkecleon/telegram-bot-bash) and [Do
|
||||
From Version 0.60 on keybord format for ```send_keyboard``` and ```send_message "mykeyboardstartshere ..."``` was changed.
|
||||
Keybords are now defined in JSON Array notation e.g. "[ \\"yes\\" , \\"no\\" ]".
|
||||
This has the advantage that you can create any type of keyboard supported by Telegram.
|
||||
**This is an incompatible change for keyboards used in older bashbot versions.**
|
||||
The old format is supported for backward compatibility, but may fail for strange corner cases.
|
||||
|
||||
*Example Keyboards*:
|
||||
|
||||
- OLD format: 'yes' 'no' (two strings)
|
||||
- NEW format: '[ "yes" , "no" ]' (string containing an array)
|
||||
- new keybord layouts, no possible with old format:
|
||||
- new keybord layouts, not possible with old format:
|
||||
- Yes No in two rows: '[ "yes" ] , [ "no" ]'
|
||||
- numpad style keyboard: '[ "1" , "2" , "3" ] , [ "4" , "5" , "6" ] , [ "7" , "8" , "9" ] , [ "0" ]'
|
||||
|
||||
@ -97,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!
|
||||
|
||||
#### $$VERSION$$ v0.60-rc2-6-g2e3c975
|
||||
#### $$VERSION$$ v0.60-rc3-0-g19a0f7e
|
||||
|
20
README.txt
20
README.txt
@ -11,8 +11,8 @@ 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
|
||||
~~~~~~~~~~~~
|
||||
Prerequisites
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
Depends on http://github.com/tmux/tmux[tmux]. Uses
|
||||
http://github.com/dominictarr/JSON.sh[JSON.sh].
|
||||
@ -35,7 +35,7 @@ Install bashbot
|
||||
....
|
||||
git clone --recursive https://github.com/topkecleon/telegram-bot-bash
|
||||
....
|
||||
3. Change to directory `telegram-bot.bash`, run `./bashbot.sh init` and
|
||||
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.
|
||||
|
||||
@ -46,10 +46,10 @@ Update bashbot
|
||||
latest update zip from github]
|
||||
2. Extract all files and copy them to your bashbot dir
|
||||
3. Run `sudo ./bashbot.sh init` to setup your environment after the
|
||||
update-
|
||||
update
|
||||
|
||||
Bashbot Documentation
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
Documentation
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
* link:doc/1_firstbot.md[Create a new Telegram Bot with botfather]
|
||||
* link:doc/2_usage.md[Getting Started]
|
||||
@ -79,14 +79,14 @@ From Version 0.60 on keybord format for `send_keyboard` and
|
||||
`send_message "mykeyboardstartshere ..."` was changed. Keybords are now
|
||||
defined in JSON Array notation e.g. "[ \"yes\" , \"no\" ]". This has the
|
||||
advantage that you can create any type of keyboard supported by
|
||||
Telegram. *This is an incompatible change for keyboards used in older
|
||||
bashbot versions.*
|
||||
Telegram. The old format is supported for backward compatibility, but
|
||||
may fail for strange corner cases.
|
||||
|
||||
_Example Keyboards_:
|
||||
|
||||
* OLD format: 'yes' 'no' (two strings)
|
||||
* NEW format: '[ "yes" , "no" ]' (string containing an array)
|
||||
* new keybord layouts, no possible with old format:
|
||||
* new keybord layouts, not possible with old format:
|
||||
** Yes No in two rows: '[ "yes" ] , [ "no" ]'
|
||||
** numpad style keyboard: '[ "1" , "2" , "3" ] , [ "4" , "5" , "6" ] , [
|
||||
"7" , "8" , "9" ] , [ "0" ]'
|
||||
@ -159,5 +159,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.60-rc2-6-g2e3c975
|
||||
latexmath:[\[VERSION\]] v0.60-rc3-0-g19a0f7e
|
||||
++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
@ -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.60-rc2-5-g591c583
|
||||
#### $$VERSION$$ v0.60-rc3-0-g19a0f7e
|
||||
|
||||
|
||||
SHELL=/bin/sh
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
# description: Start or stop telegram-bash-bot
|
||||
#
|
||||
#### $$VERSION$$ v0.60-rc2-5-g591c583
|
||||
#### $$VERSION$$ v0.60-rc3-0-g19a0f7e
|
||||
# shellcheck disable=SC2009
|
||||
# shellcheck disable=SC2181
|
||||
|
||||
|
19
bashbot.sh
19
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.60-rc2-6-g2e3c975
|
||||
#### $$VERSION$$ v0.60-rc3-0-g19a0f7e
|
||||
#
|
||||
# Exit Codes:
|
||||
# - 0 sucess (hopefully)
|
||||
@ -177,7 +177,7 @@ send_message() {
|
||||
fi
|
||||
if [ "$keyboard" != "" ]; then
|
||||
if [[ "$keyboard" != *"["* ]]; then # pre 0.60 style
|
||||
keyboard="[ ${keyboard//\" \"/\" , \"} ]"
|
||||
keyboard="[ ${keyboard//\" \"/\" \] , \[ \"} ]"
|
||||
fi
|
||||
send_keyboard "$chat" "$text" "$keyboard"
|
||||
sent=y
|
||||
@ -357,7 +357,22 @@ answer_inline_query() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
old_send_keyboard() {
|
||||
local chat="$1"
|
||||
local text="$2"
|
||||
shift 2
|
||||
local keyboard=init
|
||||
OLDIFS=$IFS
|
||||
IFS=$(echo -en "\"")
|
||||
for f in "$@" ;do [ "$f" != " " ] && keyboard="$keyboard, [\"$f\"]";done
|
||||
IFS=$OLDIFS
|
||||
keyboard=${keyboard/init, /}
|
||||
res="$(curl -s "$MSG_URL" --header "content-type: multipart/form-data" -F "chat_id=$chat" -F "text=$text" -F "reply_markup={\"keyboard\": [$keyboard],\"one_time_keyboard\": true}")"
|
||||
}
|
||||
|
||||
send_keyboard() {
|
||||
if [[ "$3" != *'['* ]]; then old_send_keyboard "$@"; return; fi
|
||||
local chat="$1"
|
||||
local text="$2"
|
||||
local keyboard="$3"
|
||||
|
2
calc
2
calc
@ -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.60-rc2-5-g591c583
|
||||
#### $$VERSION$$ v0.60-rc3-0-g19a0f7e
|
||||
|
||||
# adjust your language setting here
|
||||
# https://github.com/topkecleon/telegram-bot-bash#setting-up-your-environment
|
||||
|
@ -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.60-rc2-5-g591c583
|
||||
#### $$VERSION$$ v0.60-rc3-0-g19a0f7e
|
||||
#
|
||||
# shellcheck disable=SC2154
|
||||
# shellcheck disable=SC2034
|
||||
|
@ -61,5 +61,5 @@ group. This step is up to you actually.
|
||||
|
||||
#### [Next Getting started](2_usage.md)
|
||||
|
||||
#### $$VERSION$$ v0.60-rc2-5-g591c583
|
||||
#### $$VERSION$$ v0.60-rc3-0-g19a0f7e
|
||||
|
||||
|
@ -159,5 +159,5 @@ send_action "${CHAT[ID]}" "action"
|
||||
#### [Prev Create Bot](1_firstbot.md)
|
||||
#### [Next Advanced Usage](3_advanced.md)
|
||||
|
||||
#### $$VERSION$$ v0.60-rc2-5-g591c583
|
||||
#### $$VERSION$$ v0.60-rc3-0-g19a0f7e
|
||||
|
||||
|
@ -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.60-rc2-5-g591c583
|
||||
#### $$VERSION$$ v0.60-rc3-0-g19a0f7e
|
||||
|
||||
|
@ -104,5 +104,5 @@ An example crontab is provided in ```bashbot.cron```.
|
||||
#### [Prev Expert Use](4_expert.md)
|
||||
#### [Next Best Practice](5_practice.md)
|
||||
|
||||
#### $$VERSION$$ v0.60-rc2-5-g591c583
|
||||
#### $$VERSION$$ v0.60-rc3-0-g19a0f7e
|
||||
|
||||
|
@ -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.60-rc2-5-g591c583
|
||||
#### $$VERSION$$ v0.60-rc3-0-g19a0f7e
|
||||
|
||||
|
@ -90,14 +90,8 @@ answer_inline_query provide the result to a users Inline Query
|
||||
|
||||
----
|
||||
|
||||
### File, Location, Venu, keyboards
|
||||
### File, Location, Venue, Keyboard
|
||||
|
||||
##### get_file
|
||||
*usage:*
|
||||
|
||||
*example:*
|
||||
```bash
|
||||
```
|
||||
|
||||
##### send_file
|
||||
send_file allows you to send different type's of files, e.g. photos, stickers, audio, media, etc. [see more](https://core.telegram.org/bots/api#sending-files)
|
||||
@ -125,23 +119,22 @@ Note: since version 0.6 send_keyboard was changed to use native "JSON Array" not
|
||||
|
||||
- OLD format: 'yes' 'no' (two strings)
|
||||
- NEW format: '[ "yes" , "no" ]' (string containing an array)
|
||||
- new keybord layouts, no possible with old format:
|
||||
- new keybord layouts, not possible with old format:
|
||||
- Yes No in two rows: '[ "yes" ] , [ "no" ]'
|
||||
- numpad style keyboard: '[ "1" , "2" , "3" ] , [ "4" , "5" , "6" ] , [ "7" , "8" , "9" ] , [ "0" ]'
|
||||
|
||||
|
||||
*usage:* send_keyboard "chat-id" "keyboard"
|
||||
*usage:* send_keyboard "chat-id" "message" "keyboard"
|
||||
|
||||
*example:*
|
||||
```bash
|
||||
send_keyboard "${CHAT[ID]}" "[ \\"yes\" , \\"no\" ]""
|
||||
send_keyboard "${CHAT[ID]}" "[ \\"yes\\" ] , [ \\"no\\" ]"
|
||||
send_keyboard "${CHAT[ID]}" "[ \\"1\\" , \\"2\\" , \\"3\\" ] , [ \\"4\\" , \\"5\\" , \\"6\\" ] , [ \\"7\\" , \\"8\\" , \\"9\\" ] , [ \\"0\\" ]"
|
||||
send_keyboard "${CHAT[ID]}" "Say yes or no" "[ \\"yes\" , \\"no\" ]""
|
||||
send_keyboard "${CHAT[ID]}" "Say yes or no" "[ \\"yes\\" ] , [ \\"no\\" ]"
|
||||
send_keyboard "${CHAT[ID]}" "Enter digit" "[ \\"1\\" , \\"2\\" , \\"3\\" ] , [ \\"4\\" , \\"5\\" , \\"6\\" ] , [ \\"7\\" , \\"8\\" , \\"9\\" ] , [ \\"0\\" ]"
|
||||
```
|
||||
|
||||
##### remove_keyboard
|
||||
*usage:*
|
||||
|
||||
*usage:* remove_keybord "$CHAT[ID]" "message"
|
||||
|
||||
### Manage users
|
||||
|
||||
@ -304,6 +297,11 @@ fi
|
||||
### Bashbot internal functions
|
||||
These functions are for internal use only and must not used in your bot commands.
|
||||
|
||||
##### get_file
|
||||
*usage:* url="$(get_file "${CHAT[ID]}" "message")"
|
||||
|
||||
----
|
||||
|
||||
##### send_text
|
||||
*usage:* send_text "${CHAT[ID]}" "message"
|
||||
|
||||
@ -348,5 +346,5 @@ Send Input from Telegram to waiting Interactive Chat.
|
||||
|
||||
#### [Prev Best Practice](5_practice.md)
|
||||
|
||||
#### $$VERSION$$ v0.60-rc2-5-g591c583
|
||||
#### $$VERSION$$ v0.60-rc3-0-g19a0f7e
|
||||
|
||||
|
2
notify
2
notify
@ -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.60-rc2-5-g591c583
|
||||
#### $$VERSION$$ v0.60-rc3-0-g19a0f7e
|
||||
|
||||
# adjust your language setting here
|
||||
# https://github.com/topkecleon/telegram-bot-bash#setting-up-your-environment
|
||||
|
2
question
2
question
@ -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.60-rc2-6-g2e3c975
|
||||
#### $$VERSION$$ v0.60-rc3-0-g19a0f7e
|
||||
|
||||
# adjust your language setting here
|
||||
# https://github.com/topkecleon/telegram-bot-bash#setting-up-your-environment
|
||||
|
Loading…
Reference in New Issue
Block a user