mirror of
https://github.com/octoleo/telegram-bot-bash.git
synced 2024-11-26 01:07:34 +00:00
dev3-rc1 candidate
This commit is contained in:
parent
14eb3520d5
commit
bf97646361
@ -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!
|
||||
|
||||
#### $$VERSION$$ v0.6-rc1-0-gc001d14
|
||||
#### $$VERSION$$ v0.6-rc1-7-g14eb352
|
||||
|
@ -122,5 +122,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.6-rc1-0-gc001d14
|
||||
latexmath:[\[VERSION\]] v0.6-rc1-7-g14eb352
|
||||
+++++++++++++++++++++++++++++++++++++++++++
|
||||
|
@ -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.6-rc1-0-gc001d14
|
||||
#### $$VERSION$$ v0.6-rc1-7-g14eb352
|
||||
|
||||
|
||||
SHELL=/bin/sh
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
# description: Start or stop telegram-bash-bot
|
||||
#
|
||||
#### $$VERSION$$ v0.6-rc1-0-gc001d14
|
||||
#### $$VERSION$$ v0.6-rc1-7-g14eb352
|
||||
# shellcheck disable=SC2009
|
||||
# shellcheck disable=SC2181
|
||||
|
||||
|
@ -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.6-rc1-5-g2ac5e6f
|
||||
#### $$VERSION$$ v0.6-rc1-7-g14eb352
|
||||
#
|
||||
# Exit Codes:
|
||||
# - 0 sucess (hopefully)
|
||||
|
3
calc
3
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.6-rc1-0-gc001d14
|
||||
#### $$VERSION$$ v0.6-rc1-7-g14eb352
|
||||
|
||||
# adjust your language setting here
|
||||
# https://github.com/topkecleon/telegram-bot-bash#setting-up-your-environment
|
||||
@ -20,6 +20,7 @@ read -r A
|
||||
echo 'Enter second number.'
|
||||
read -r B
|
||||
echo 'Select Operation: mykeyboardstartshere "Addition" "Subtraction" "Multiplication" "Division" "Cancel"'
|
||||
echo 'Your anwser can be: add, sub, mul, div or cancel'
|
||||
read -r opt
|
||||
echo -n 'Result: '
|
||||
case $opt in
|
||||
|
22
commands.sh
22
commands.sh
@ -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.6-rc1-0-gc001d14
|
||||
#### $$VERSION$$ v0.6-rc1-7-g14eb352
|
||||
#
|
||||
# shellcheck disable=SC2154
|
||||
# shellcheck disable=SC2034
|
||||
@ -71,7 +71,7 @@ else
|
||||
[ ! -z "${LOCATION[*]}" ] && send_location "${CHAT[ID]}" "${LOCATION[LATITUDE]}" "${LOCATION[LONGITUDE]}"
|
||||
|
||||
# Inline
|
||||
if [ $INLINE == 1 ]; then
|
||||
if [ "$INLINE" = 1 ]; then
|
||||
# inline query data
|
||||
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)"
|
||||
@ -80,18 +80,18 @@ else
|
||||
iQUERY_MSG="$(echo "$res" | sed 's/^.*\(inline_query.*\)/\1/g' | cut -d '"' -f5 | tail -6 | head -1)"
|
||||
|
||||
# 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"
|
||||
fi
|
||||
|
||||
if [[ "$iQUERY_MSG" == "sticker" ]]; then
|
||||
if [[ "$iQUERY_MSG" = "sticker" ]]; then
|
||||
answer_inline_query "$iQUERY_ID" "cached_sticker" "BQADBAAD_QEAAiSFLwABWSYyiuj-g4AC"
|
||||
fi
|
||||
|
||||
if [[ "$iQUERY_MSG" == "gif" ]]; then
|
||||
if [[ "$iQUERY_MSG" = "gif" ]]; then
|
||||
answer_inline_query "$iQUERY_ID" "cached_gif" "BQADBAADIwYAAmwsDAABlIia56QGP0YC"
|
||||
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"
|
||||
fi
|
||||
fi &
|
||||
@ -131,8 +131,8 @@ else
|
||||
;;
|
||||
'/start')
|
||||
send_action "${CHAT[ID]}" "typing"
|
||||
user_is_botadmin "${USER[ID]}" && send_markdown_message "${CHAT[ID]}" "You are *BOTADMIN*."
|
||||
if user_is_allowed "${USER[ID]}" "start" "${CHAT[ID]}" ; then
|
||||
_is_botadmin && send_markdown_message "${CHAT[ID]}" "You are *BOTADMIN*."
|
||||
if _is_allowed "start" ; then
|
||||
bot_help "${CHAT[ID]}"
|
||||
else
|
||||
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
|
||||
if user_is_admin "${CHAT[ID]}" "${USER[ID]}"; then
|
||||
if _is_admin ; then
|
||||
send_markdown_message "${CHAT[ID]}" "*LEAVING CHAT...*"
|
||||
leave_chat "${CHAT[ID]}"
|
||||
fi
|
||||
@ -155,8 +155,8 @@ else
|
||||
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 tmux ls | grep -v send | grep -q "$copname";then inproc; else send_message "${CHAT[ID]}" "$MESSAGE" "safe";fi
|
||||
*) # forward input to interactive chat if running
|
||||
if tmux ls | grep -v send | grep -q $copname;then inproc; fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
@ -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.
|
||||
|
||||
#### $$VERSION$$ v0.6-rc1-6-ge18b200
|
||||
#### $$VERSION$$ v0.6-rc1-7-g14eb352
|
||||
|
||||
|
@ -154,6 +154,6 @@ Allowed values: typing for text messages, upload_photo for photos, record_video
|
||||
send_action "${CHAT[ID]}" "action"
|
||||
```
|
||||
|
||||
#### $$VERSION$$ v0.6-rc1-6-ge18b200
|
||||
#### $$VERSION$$ v0.6-rc1-7-g14eb352
|
||||
|
||||
|
||||
|
@ -153,5 +153,5 @@ To send stickers through an *inline query*:
|
||||
answer_inline_query "$iQUERY_ID" "cached_sticker" "identifier for the sticker"
|
||||
```
|
||||
|
||||
#### $$VERSION$$ v0.6-rc1-6-ge18b200
|
||||
#### $$VERSION$$ v0.6-rc1-7-g14eb352
|
||||
|
||||
|
@ -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```
|
||||
|
||||
|
||||
#### $$VERSION$$ v0.6-rc1-6-ge18b200
|
||||
#### $$VERSION$$ v0.6-rc1-7-g14eb352
|
||||
|
||||
|
@ -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!
|
||||
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
|
||||
|
||||
|
@ -30,12 +30,12 @@
|
||||
----
|
||||
|
||||
##### send_message
|
||||
Send Message is only used to process the output of interactive chats an background jobs.
|
||||
I reccommend to use the more dedicated send_xxx_message() functions above.
|
||||
Send Message must (only) used to process the output of interactive chats and background jobs.
|
||||
**For your commands I reccommend the more dedicated send_xxx_message() functions above.**
|
||||
|
||||
*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:*
|
||||
|
||||
### 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
|
||||
*usage:*
|
||||
|
||||
*example:*
|
||||
|
||||
----
|
||||
|
||||
##### JsonDecode
|
||||
*usage:*
|
||||
|
||||
*example:*
|
||||
|
||||
##### JsonGetString
|
||||
*usage:*
|
||||
|
||||
*example:*
|
||||
|
||||
##### JsonGetValue
|
||||
*usage:*
|
||||
|
||||
*example:*
|
||||
|
||||
----
|
||||
|
||||
##### get_chat_member_status
|
||||
*usage:*
|
||||
|
||||
*example:*
|
||||
|
||||
----
|
||||
|
||||
##### process_client
|
||||
*usage:*
|
||||
|
||||
*example:*
|
||||
Every Message sent to your Bot is processd by this function. It parse the send JSON and assign the found Values to bash variables.
|
||||
|
||||
##### process_updates
|
||||
*usage:*
|
||||
|
||||
*example:*
|
||||
If new updates are availible, this functions gets the JSON from Telegram and dispatch it.
|
||||
|
||||
----
|
||||
##### 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
|
||||
*usage:*
|
||||
Send Input from Telegram to waiting Interactive Chat.
|
||||
|
||||
*example:*
|
||||
|
||||
#### $$VERSION$$ v0.6-rc1-6-ge18b200
|
||||
#### $$VERSION$$ v0.6-rc1-7-g14eb352
|
||||
|
||||
|
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.6-rc1-0-gc001d14
|
||||
#### $$VERSION$$ v0.6-rc1-7-g14eb352
|
||||
|
||||
# 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.6-rc1-0-gc001d14
|
||||
#### $$VERSION$$ v0.6-rc1-7-g14eb352
|
||||
|
||||
# adjust your language setting here
|
||||
# https://github.com/topkecleon/telegram-bot-bash#setting-up-your-environment
|
||||
|
Loading…
Reference in New Issue
Block a user