dev3-rc1 candidate

This commit is contained in:
Kay Marquardt (Gnadelwartz) 2019-04-15 14:17:18 +02:00
parent 14eb3520d5
commit bf97646361
16 changed files with 36 additions and 51 deletions

View File

@ -77,4 +77,4 @@ No - its not less (in)secure as any other Bot written in any other language. But
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.6-rc1-0-gc001d14 #### $$VERSION$$ v0.6-rc1-7-g14eb352

View File

@ -122,5 +122,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.6-rc1-0-gc001d14 latexmath:[\[VERSION\]] v0.6-rc1-7-g14eb352
+++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++

View File

@ -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$$ v0.6-rc1-0-gc001d14 #### $$VERSION$$ v0.6-rc1-7-g14eb352
SHELL=/bin/sh SHELL=/bin/sh

View File

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
# description: Start or stop telegram-bash-bot # description: Start or stop telegram-bash-bot
# #
#### $$VERSION$$ v0.6-rc1-0-gc001d14 #### $$VERSION$$ v0.6-rc1-7-g14eb352
# shellcheck disable=SC2009 # shellcheck disable=SC2009
# shellcheck disable=SC2181 # shellcheck disable=SC2181

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.6-rc1-5-g2ac5e6f #### $$VERSION$$ v0.6-rc1-7-g14eb352
# #
# Exit Codes: # Exit Codes:
# - 0 sucess (hopefully) # - 0 sucess (hopefully)

3
calc
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.6-rc1-0-gc001d14 #### $$VERSION$$ v0.6-rc1-7-g14eb352
# 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
@ -20,6 +20,7 @@ read -r A
echo 'Enter second number.' echo 'Enter second number.'
read -r B read -r B
echo 'Select Operation: mykeyboardstartshere "Addition" "Subtraction" "Multiplication" "Division" "Cancel"' echo 'Select Operation: mykeyboardstartshere "Addition" "Subtraction" "Multiplication" "Division" "Cancel"'
echo 'Your anwser can be: add, sub, mul, div or cancel'
read -r opt read -r opt
echo -n 'Result: ' echo -n 'Result: '
case $opt in case $opt in

View File

@ -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$$ v0.6-rc1-0-gc001d14 #### $$VERSION$$ v0.6-rc1-7-g14eb352
# #
# shellcheck disable=SC2154 # shellcheck disable=SC2154
# shellcheck disable=SC2034 # shellcheck disable=SC2034
@ -71,7 +71,7 @@ else
[ ! -z "${LOCATION[*]}" ] && send_location "${CHAT[ID]}" "${LOCATION[LATITUDE]}" "${LOCATION[LONGITUDE]}" [ ! -z "${LOCATION[*]}" ] && send_location "${CHAT[ID]}" "${LOCATION[LATITUDE]}" "${LOCATION[LONGITUDE]}"
# Inline # Inline
if [ $INLINE == 1 ]; then if [ "$INLINE" = 1 ]; then
# inline query data # inline query data
iUSER[FIRST_NAME]="$(echo "$res" | sed 's/^.*\(first_name.*\)/\1/g' | cut -d '"' -f3 | tail -1)" iUSER[FIRST_NAME]="$(echo "$res" | sed 's/^.*\(first_name.*\)/\1/g' | cut -d '"' -f3 | tail -1)"
iUSER[LAST_NAME]="$(echo "$res" | sed 's/^.*\(last_name.*\)/\1/g' | cut -d '"' -f3)" iUSER[LAST_NAME]="$(echo "$res" | sed 's/^.*\(last_name.*\)/\1/g' | cut -d '"' -f3)"
@ -80,18 +80,18 @@ else
iQUERY_MSG="$(echo "$res" | sed 's/^.*\(inline_query.*\)/\1/g' | cut -d '"' -f5 | tail -6 | head -1)" iQUERY_MSG="$(echo "$res" | sed 's/^.*\(inline_query.*\)/\1/g' | cut -d '"' -f5 | tail -6 | head -1)"
# Inline examples # Inline examples
if [[ "$iQUERY_MSG" == "photo" ]]; then if [[ "$iQUERY_MSG" = "photo" ]]; then
answer_inline_query "$iQUERY_ID" "photo" "http://blog.techhysahil.com/wp-content/uploads/2016/01/Bash_Scripting.jpeg" "http://blog.techhysahil.com/wp-content/uploads/2016/01/Bash_Scripting.jpeg" answer_inline_query "$iQUERY_ID" "photo" "http://blog.techhysahil.com/wp-content/uploads/2016/01/Bash_Scripting.jpeg" "http://blog.techhysahil.com/wp-content/uploads/2016/01/Bash_Scripting.jpeg"
fi fi
if [[ "$iQUERY_MSG" == "sticker" ]]; then if [[ "$iQUERY_MSG" = "sticker" ]]; then
answer_inline_query "$iQUERY_ID" "cached_sticker" "BQADBAAD_QEAAiSFLwABWSYyiuj-g4AC" answer_inline_query "$iQUERY_ID" "cached_sticker" "BQADBAAD_QEAAiSFLwABWSYyiuj-g4AC"
fi fi
if [[ "$iQUERY_MSG" == "gif" ]]; then if [[ "$iQUERY_MSG" = "gif" ]]; then
answer_inline_query "$iQUERY_ID" "cached_gif" "BQADBAADIwYAAmwsDAABlIia56QGP0YC" answer_inline_query "$iQUERY_ID" "cached_gif" "BQADBAADIwYAAmwsDAABlIia56QGP0YC"
fi fi
if [[ "$iQUERY_MSG" == "web" ]]; then if [[ "$iQUERY_MSG" = "web" ]]; then
answer_inline_query "$iQUERY_ID" "article" "GitHub" "http://github.com/topkecleon/telegram-bot-bash" answer_inline_query "$iQUERY_ID" "article" "GitHub" "http://github.com/topkecleon/telegram-bot-bash"
fi fi
fi & fi &
@ -131,8 +131,8 @@ else
;; ;;
'/start') '/start')
send_action "${CHAT[ID]}" "typing" send_action "${CHAT[ID]}" "typing"
user_is_botadmin "${USER[ID]}" && send_markdown_message "${CHAT[ID]}" "You are *BOTADMIN*." _is_botadmin && send_markdown_message "${CHAT[ID]}" "You are *BOTADMIN*."
if user_is_allowed "${USER[ID]}" "start" "${CHAT[ID]}" ; then if _is_allowed "start" ; then
bot_help "${CHAT[ID]}" bot_help "${CHAT[ID]}"
else else
send_normal_message "${CHAT[ID]}" "You are not allowed to start Bot." send_normal_message "${CHAT[ID]}" "You are not allowed to start Bot."
@ -140,7 +140,7 @@ else
;; ;;
'/leavechat') # bot leave chat if user is admin in chat '/leavechat') # bot leave chat if user is admin in chat
if user_is_admin "${CHAT[ID]}" "${USER[ID]}"; then if _is_admin ; then
send_markdown_message "${CHAT[ID]}" "*LEAVING CHAT...*" send_markdown_message "${CHAT[ID]}" "*LEAVING CHAT...*"
leave_chat "${CHAT[ID]}" leave_chat "${CHAT[ID]}"
fi fi
@ -155,8 +155,8 @@ else
checkprog checkprog
if [ "$res" -eq 0 ] ; then killproc && send_message "${CHAT[ID]}" "Command canceled.";else send_message "${CHAT[ID]}" "No command is currently running.";fi if [ "$res" -eq 0 ] ; then killproc && send_message "${CHAT[ID]}" "Command canceled.";else send_message "${CHAT[ID]}" "No command is currently running.";fi
;; ;;
*) *) # forward input to interactive chat if running
if tmux ls | grep -v send | grep -q "$copname";then inproc; else send_message "${CHAT[ID]}" "$MESSAGE" "safe";fi if tmux ls | grep -v send | grep -q $copname;then inproc; fi
;; ;;
esac esac
fi fi

View File

@ -70,5 +70,5 @@ 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.
#### $$VERSION$$ v0.6-rc1-6-ge18b200 #### $$VERSION$$ v0.6-rc1-7-g14eb352

View File

@ -154,6 +154,6 @@ Allowed values: typing for text messages, upload_photo for photos, record_video
send_action "${CHAT[ID]}" "action" send_action "${CHAT[ID]}" "action"
``` ```
#### $$VERSION$$ v0.6-rc1-6-ge18b200 #### $$VERSION$$ v0.6-rc1-7-g14eb352

View File

@ -153,5 +153,5 @@ To send stickers through an *inline query*:
answer_inline_query "$iQUERY_ID" "cached_sticker" "identifier for the sticker" answer_inline_query "$iQUERY_ID" "cached_sticker" "identifier for the sticker"
``` ```
#### $$VERSION$$ v0.6-rc1-6-ge18b200 #### $$VERSION$$ v0.6-rc1-7-g14eb352

View File

@ -102,5 +102,5 @@ An example crontab is provided in ```bashbot.cron```.
- if you run bashbot as an other user or a system service edit ```bashbot.cron``` to fit your needs and replace username```nobody``` with the username you want to run bashbot. copy the modified file to ```/etc/cron.d/bashbot``` - if you run bashbot as an other user or a system service edit ```bashbot.cron``` to fit your needs and replace username```nobody``` with the username you want to run bashbot. copy the modified file to ```/etc/cron.d/bashbot```
#### $$VERSION$$ v0.6-rc1-6-ge18b200 #### $$VERSION$$ v0.6-rc1-7-g14eb352

View File

@ -112,5 +112,5 @@ In bashbot.sh line 490:
Here are two warnings in bashbots scripts. The first is a hint you may use shell substitions instead of sed, this is really possible and much faster! Here are two warnings in bashbots scripts. The first is a hint you may use shell substitions instead of sed, this is really possible and much faster!
The second warning is about an unused variable, this is true because in our examples CONTACT is not used but assigned in case you want to use it :-) The second warning is about an unused variable, this is true because in our examples CONTACT is not used but assigned in case you want to use it :-)
#### $$VERSION$$ v0.6-rc1-6-ge18b200 #### $$VERSION$$ v0.6-rc1-7-g14eb352

View File

@ -30,12 +30,12 @@
---- ----
##### send_message ##### send_message
Send Message is only used to process the output of interactive chats an background jobs. Send Message must (only) used to process the output of interactive chats and background jobs.
I reccommend to use the more dedicated send_xxx_message() functions above. **For your commands I reccommend the more dedicated send_xxx_message() functions above.**
*usage:* *usage:*
*example:* see [Usage](2_usage.md#send_message) and [Advanced Usage](3_advanced.md#Interactive-Chats) *example:* - see [Usage](2_usage.md#send_message) and [Advanced Usage](3_advanced.md#Interactive-Chats)
---- ----
@ -161,59 +161,43 @@ I reccommend to use the more dedicated send_xxx_message() functions above.
*example:* *example:*
### Bashbot internal ### Bashbot internal
These function are for internal use only and must not used for your bot commands. These functions are for internal use only and must not used in your bot commands.
##### send_text ##### send_text
*usage:* *usage:*
*example:*
---- ----
##### JsonDecode ##### JsonDecode
*usage:* *usage:*
*example:*
##### JsonGetString ##### JsonGetString
*usage:* *usage:*
*example:*
##### JsonGetValue ##### JsonGetValue
*usage:* *usage:*
*example:*
---- ----
##### get_chat_member_status ##### get_chat_member_status
*usage:* *usage:*
*example:*
---- ----
##### process_client ##### process_client
*usage:* Every Message sent to your Bot is processd by this function. It parse the send JSON and assign the found Values to bash variables.
*example:*
##### process_updates ##### process_updates
*usage:* If new updates are availible, this functions gets the JSON from Telegram and dispatch it.
*example:*
---- ----
##### getBotName ##### getBotName
*usage:* The name of your bot is availible as bash variable "$ME", there is no need to call this function if Bot is running.
*example:* *usage:* ME="$(getBotNiname)"
##### inproc ##### inproc
*usage:* Send Input from Telegram to waiting Interactive Chat.
*example:* #### $$VERSION$$ v0.6-rc1-7-g14eb352
#### $$VERSION$$ v0.6-rc1-6-ge18b200

2
notify
View File

@ -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$$ v0.6-rc1-0-gc001d14 #### $$VERSION$$ v0.6-rc1-7-g14eb352
# 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

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.6-rc1-0-gc001d14 #### $$VERSION$$ v0.6-rc1-7-g14eb352
# 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

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
# #
#### $$VERSION$$ v0.6-rc1-0-gc001d14 #### $$VERSION$$ v0.6-rc1-7-g14eb352
# shellcheck disable=SC2016 # shellcheck disable=SC2016
# #
# Easy Versioning in git: # Easy Versioning in git: