2019-04-16 18:43:54 +00:00
#### [Home](../README.md)
2019-04-15 19:06:29 +00:00
## Bashbot function reference
2019-04-15 09:49:13 +00:00
2019-04-16 11:29:49 +00:00
### Send, forward, delete messages
2019-04-15 09:49:13 +00:00
2019-04-15 10:52:38 +00:00
##### send_action
2019-04-16 11:29:49 +00:00
```send_action``` shows users what your bot is currently doing.
2019-04-15 17:13:39 +00:00
*usage:* send_action "${CHAT[ID]}" "action"
2019-04-15 09:49:13 +00:00
2019-04-16 11:29:49 +00:00
*"action":* ```typing```, ```upload_photo```, ```record_video```, ```upload_video```, ```record_audio```, ```upload_audio```, ```upload_document```, ```find_location```.
2019-05-10 10:04:49 +00:00
*alias:* _action "action"
2019-04-15 10:52:38 +00:00
*example:*
2019-04-15 17:13:39 +00:00
```bash
send_action "${CHAT[ID]}" "typing"
send_action "${CHAT[ID]}" "record_audio"
```
2019-04-15 09:49:13 +00:00
2019-04-15 10:52:38 +00:00
##### send_normal_message
2019-04-16 11:29:49 +00:00
```send_normal_message``` sends text only messages to the given chat.
2019-04-15 19:06:29 +00:00
*usage:* send_normal_message "${CHAT[ID]}" "message"
2019-04-15 09:49:13 +00:00
2019-05-10 10:04:49 +00:00
*alias:* _normal_message "message"
2019-04-15 10:52:38 +00:00
*example:*
2019-04-15 19:06:29 +00:00
```bash
send_normal_message "${CHAT[ID]}" "this is a text message"
```
2019-04-15 09:49:13 +00:00
2019-04-15 10:52:38 +00:00
##### send_markdown_message
2019-04-16 11:29:49 +00:00
```send_markdown_message``` sends markdown style messages to the given chat.
Telegram supports a [reduced set of Markdown ](https://core.telegram.org/bots/api#markdown-style ) only
2019-04-15 19:06:29 +00:00
2019-04-16 11:29:49 +00:00
*usage:* send_markdown_message "${CHAT[ID]}" "markdown message"
2019-04-15 10:52:38 +00:00
2019-05-10 10:04:49 +00:00
*alias:* _markdown "message"
2019-04-15 10:52:38 +00:00
*example:*
2019-04-15 19:06:29 +00:00
```bash
2019-04-25 14:59:17 +00:00
send_markdown_message "${CHAT[ID]}" "this is a markdown message, next word is *bold* "
send_markdown_message "${CHAT[ID]}" "*bold* _italic_ [text ](link )"
2019-04-15 19:06:29 +00:00
```
2019-04-15 10:52:38 +00:00
##### send_html_message
2019-04-16 11:29:49 +00:00
```send_html_message``` sends HTML style messages to the given chat.
Telegram supports a [reduced set of HTML ](https://core.telegram.org/bots/api#html-style ) only
2019-04-15 19:06:29 +00:00
2019-04-16 11:29:49 +00:00
*usage:* send_html_message "${CHAT[ID]}" "html message"
2019-04-15 10:52:38 +00:00
2019-05-10 10:04:49 +00:00
*alias:* _html_message "message"
2019-04-15 10:52:38 +00:00
*example:*
2019-04-15 19:06:29 +00:00
```bash
send_normal_message "${CHAT[ID]}" "this is a markdown message, next word is < b > bold< / b > "
send_normal_message "${CHAT[ID]}" "< b > bold< / b > < i > italic>< i > < em > italic>/em> < a href = "link" > Text< / a > "
```
2019-04-15 10:52:38 +00:00
2019-04-16 11:29:49 +00:00
##### forward_message
```forward_mesage``` forwards a messsage to the given chat.
2019-04-15 10:52:38 +00:00
2019-04-16 11:29:49 +00:00
*usage:* forward_message "chat_to" "chat_from" "${MESSAGE[ID]}"
2019-04-24 08:07:46 +00:00
*old call:* forward "${CHAT[ID]}" "$FROMCHAT" "${MESSAGE[ID]}"
2019-04-15 09:49:13 +00:00
2019-05-10 10:04:49 +00:00
*alias:* _forward "$FROMCHAT" "${MESSAGE[ID]}"
2019-04-27 11:02:10 +00:00
See also [Text formating options ](https://core.telegram.org/bots/api#formatting-options )
2019-04-15 09:49:13 +00:00
----
2019-04-15 10:52:38 +00:00
##### delete_message
2019-04-16 11:29:49 +00:00
If your Bot is admin of a Chat he can delete every message, if not he can delete only his messages.
2019-04-15 10:52:38 +00:00
2019-04-15 19:06:29 +00:00
*usage:* delete_message "${CHAT[ID]}" "${MESSAGE[ID]}"
2019-04-15 09:49:13 +00:00
2019-05-10 10:04:49 +00:00
*alias:* _del_message "${MESSAGE[ID]}"
2019-04-27 11:02:10 +00:00
See also [deleteMessage limitations ](https://core.telegram.org/bots/api#deletemessage )
2019-04-27 21:15:05 +00:00
2019-04-15 09:49:13 +00:00
----
2019-04-17 07:34:02 +00:00
### File, Location, Venue, Keyboard
2019-04-15 09:49:13 +00:00
2019-04-15 10:52:38 +00:00
##### send_file
2019-04-15 19:13:08 +00:00
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 )
2019-04-15 19:06:29 +00:00
*usage:* send_file "${CHAT[ID]}" "file" "caption"
2019-04-15 09:49:13 +00:00
2019-04-15 10:52:38 +00:00
*example:*
2019-04-15 19:06:29 +00:00
```bash
send_file "${CHAT[ID]}" "/home/user/doge.jpg" "Lool"
send_file "${CHAT[ID]}" "https://www.domain,com/something.gif" "Something"
```
2019-04-15 09:49:13 +00:00
2019-04-15 10:52:38 +00:00
##### send_location
2019-04-15 19:06:29 +00:00
*usage:* send_location "${CHAT[ID]}" "Latitude" "Longitude"
2019-04-15 10:52:38 +00:00
##### send_venue
2019-04-15 19:06:29 +00:00
*usage:* send_venue "${CHAT[ID]}" "Latitude" "Longitude" "Title" "Address" "foursquare id (optional)"
2019-04-15 10:52:38 +00:00
2019-04-15 09:49:13 +00:00
----
2019-04-15 10:52:38 +00:00
##### send_keyboard
2019-04-16 11:29:49 +00:00
Note: since version 0.6 send_keyboard was changed to use native "JSON Array" notation as used from Telegram. Example Keybord Array definitions:
2019-04-18 08:35:18 +00:00
- yes no in two rows:
- OLD format: 'yes' 'no' (two strings)
- NEW format: '[ "yes" ] , [ "no" ]' (two arrays with a string)
- new layouts made easy with NEW format:
- Yes No in one row: '[ "yes" , "no" ]'
- Yes No plus Maybe in 2.row: '[ "yes" , "no" ] , [ "maybe" ]'
2019-04-16 18:43:54 +00:00
- numpad style keyboard: '[ "1" , "2" , "3" ] , [ "4" , "5" , "6" ] , [ "7" , "8" , "9" ] , [ "0" ]'
2019-04-16 11:29:49 +00:00
2019-04-17 07:34:02 +00:00
*usage:* send_keyboard "chat-id" "message" "keyboard"
2019-04-15 10:52:38 +00:00
2019-05-10 10:04:49 +00:00
*alias:* _keyboard "message" "keyboard"
2019-04-15 10:52:38 +00:00
*example:*
2019-04-15 17:13:39 +00:00
```bash
2019-04-17 07:34:02 +00:00
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\\" ]"
2019-04-15 17:13:39 +00:00
```
2019-04-15 10:52:38 +00:00
##### remove_keyboard
2019-04-17 07:34:02 +00:00
*usage:* remove_keybord "$CHAT[ID]" "message"
2019-04-15 09:49:13 +00:00
2019-05-10 10:04:49 +00:00
*alias:* _del_keyboard "message"
2019-04-27 21:15:05 +00:00
*See also: [Keyboard Markup ](https://core.telegram.org/bots/api/#replykeyboardmarkup )*
2019-04-27 11:02:10 +00:00
----
2019-04-26 15:19:48 +00:00
##### send_button
*usage:* send_button "chat-id" "message" "text" "URL"
2019-04-25 14:59:17 +00:00
2019-04-26 15:19:48 +00:00
*alias:* _button "text" "URL"
2019-04-25 14:59:17 +00:00
*example:*
```bash
2019-04-26 15:19:48 +00:00
send_button "${CHAT[ID]}" "MAKE MONEY FAST!!!" "Visit my Shop" "https://dealz.rrr.de"
2019-04-25 14:59:17 +00:00
```
2019-04-25 20:17:24 +00:00
##### send_inline_keyboard
This allows to place multiple inline buttons in a row. The inline buttons must specified as a JSON array in the following format:
2019-04-25 14:59:17 +00:00
```[ {"text":"text1", "url":"url1"}, ... {"text":"textN", "url":"urlN"} ]```
2019-04-27 21:15:05 +00:00
Each button consists of a pair of text and URL values, sourrounded by '{ }', multiple buttons are seperated by '**,**' and everthing is wrapped in '[ ]'.
2019-04-25 20:17:24 +00:00
*usage:* send_inline_keyboard "chat-id" "message" "[ {"text":"text", "url":"url"} ...]"
2019-04-25 14:59:17 +00:00
*alias:* _inline_keyboard "[{"text":"text", "url":"url"} ...]"
*example:*
```bash
send_inline_keyboard "${CHAT[ID]}" "MAKE MONEY FAST!!!" '[{"text":"Visit my Shop", url"":"https://dealz.rrr.de"}]'
send_inline_keyboard "${CHAT[ID]}" "" '[{"text":"button 1", url"":"url 1"}, {"text":"button 2", url"":"url 2"} ]'
send_inline_keyboard "${CHAT[ID]}" "" '[{"text":"b 1", url"":"u 1"}, {"text":"b 2", url"":"u 2"}, {"text":"b 2", url"":"u 2"} ]'
```
2019-04-27 21:15:05 +00:00
*See also [Inline keyboard markup ](https://core.telegram.org/bots/api/#inlinekeyboardmarkup )*
2019-04-27 11:02:10 +00:00
2019-04-24 08:07:46 +00:00
----
2019-05-10 10:04:49 +00:00
### User Access Control
2019-04-15 09:49:13 +00:00
2019-04-15 10:52:38 +00:00
##### kick_chat_member
2019-04-25 20:17:24 +00:00
If your Bot is a chat admin he can kick and ban a user.
2019-04-15 19:06:29 +00:00
2019-04-24 11:34:44 +00:00
*usage:* kick_chat_member "${CHAT[ID]}" "${USER[ID]}"
2019-04-15 09:49:13 +00:00
2019-04-25 14:59:17 +00:00
*alias:* _kick_user "${USER[ID]}"
2019-04-15 09:49:13 +00:00
2019-04-15 10:52:38 +00:00
##### unban_chat_member
2019-04-25 20:17:24 +00:00
If your Bot is a chat admine can unban a kicked user.
2019-04-15 10:52:38 +00:00
2019-04-15 19:06:29 +00:00
*usage:* unban_chat_member "${CHAT[ID]}" "${USER[ID]}"
2019-04-15 10:52:38 +00:00
2019-04-25 14:59:17 +00:00
*alias:* _unban "${USER[ID]}"
2019-04-24 11:34:44 +00:00
2019-04-15 10:52:38 +00:00
##### leave_chat
2019-04-25 20:17:24 +00:00
Your Bot will leave the chat.
2019-04-15 10:52:38 +00:00
2019-04-15 19:06:29 +00:00
*usage:* leave_chat "${CHAT[ID]}"
2019-04-25 14:59:17 +00:00
*alias:* _leave
2019-04-24 11:34:44 +00:00
2019-04-15 19:06:29 +00:00
```bash
if _is_admin ; then
send_markdown_message "${CHAT[ID]}" "*LEAVING CHAT...*"
leave_chat "${CHAT[ID]}"
fi
```
2019-04-15 09:49:13 +00:00
2019-04-27 21:15:05 +00:00
'See also [kick Chat Member ](https://core.telegram.org/bots/api/#kickchatmember )*
2019-04-27 11:02:10 +00:00
2019-04-15 09:49:13 +00:00
----
2019-04-24 08:07:46 +00:00
2019-04-23 13:48:58 +00:00
##### user_is_botadmin
2019-04-25 20:17:24 +00:00
Return true (0) if user is admin of bot, user id if botadmin is read from file './botadmin'.
2019-04-23 13:48:58 +00:00
*usage:* user_is_botadmin "${USER[ID]}"
2019-05-10 10:04:49 +00:00
*alias:* _is_botadmin
2019-04-23 13:48:58 +00:00
*example:*
```bash
_is_botadmin && send_markdown_message "${CHAT[ID]}" "You are *BOTADMIN* ."
```
2019-04-15 09:49:13 +00:00
2019-04-15 10:52:38 +00:00
##### user_is_creator
2019-04-16 14:45:26 +00:00
Return true (0) if user is creator of given chat or chat is a private chat.
2019-04-15 10:52:38 +00:00
2019-04-15 19:06:29 +00:00
*usage:* user_is_creator "${CHAT[ID]}" "${USER[ID]}"
2019-05-10 10:04:49 +00:00
*alias:* _is_creator
2019-04-15 09:49:13 +00:00
2019-04-15 10:52:38 +00:00
##### user_is_admin
2019-04-16 14:45:26 +00:00
Return true (0) if user is admin or creator of given chat.
2019-04-15 19:06:29 +00:00
*usage:* user_is_admin "${CHAT[ID]}" "${USER[ID]}"
2019-05-10 10:04:49 +00:00
*alias:* _is_admin
2019-04-15 09:49:13 +00:00
2019-04-15 10:52:38 +00:00
*example:*
2019-04-15 19:06:29 +00:00
```bash
if _is_admin ; then
send_markdown_message "${CHAT[ID]}" "*LEAVING CHAT...*"
leave_chat "${CHAT[ID]}"
fi
```
2019-04-15 09:49:13 +00:00
2019-04-27 21:15:05 +00:00
*See also [Chat Member ](https://core.telegram.org/bots/api/#chatmember )*
2019-04-27 11:02:10 +00:00
2019-04-15 10:52:38 +00:00
##### user_is_allowed
2019-04-30 12:21:24 +00:00
Bahsbot supports User Access Control, see [Advanced Usage ](3_advanced.md )
2019-04-15 19:06:29 +00:00
*usage:* user_is_allowed "${USER[ID]}" "what" "${CHAT[ID]}"
2019-04-15 10:52:38 +00:00
*example:*
2019-04-15 19:06:29 +00:00
```bash
if ! user_is_allowed "${USER[ID]}" "start" "${CHAT[ID]}" ; then
send_normal_message "${CHAT[ID]}" "You are not allowed to start Bot."
fi
```
2019-04-15 09:49:13 +00:00
2019-04-24 08:07:46 +00:00
----
2019-05-09 12:49:23 +00:00
### Inline Queries - answer direct queries to bot
You must include ```source modules/inline.sh``` in 'commands.sh' to have the following functions availible.
Inline Queries allows users to interact with your bot directly without sending extra commands.
2019-05-09 13:02:01 +00:00
As an answer to an inline query you can send back one or more results to the Telegram client.
The Telegram client will then show the results to the user and let him select one.
2019-05-09 12:49:23 +00:00
##### answer_inline_query
answer_inline_query is provided for backward compatibility with older versions of bashbot.
It send back only one response to an inline query.
*usage:* answer_inline_query "$i{QUERY[ID]}" "type" "type arg 1" ... "type arg n"
*example:* - see [Advanced Usage ](3_advanced.md#Inline-queries )
##### answer_inline_multi
anser_inline_multi allows you to send back a list of responses. responses must be seperated by ','.
*usage:* answer_inline_multi "${iQUERY[ID]}" "res, res, ... res"
*example:*
```bash
# note the starting " and ending " !!
answer_inline_multi "${iQUERY[ID]}" "
$(inline_query_compose "1" "photo" "https://avatars0.githubusercontent.com/u/13046303") ,
...
$(inline_query_compose "n" "photo" "https://avatars1.githubusercontent.com/u/4593242")
"
```
#### inline_query_compose
inline_query_compose composes one response element to to send back.
*usage:* inline_query_compose ID type args ....
```
2019-05-09 13:02:01 +00:00
ID = unique ID for this response, 1-64 byte long
type = type of answer, e.g. article, photo, video, location ...
args = mandatory arguments in the order they are described in telegram documentation
2019-05-09 12:49:23 +00:00
```
2019-05-09 13:02:01 +00:00
Currently the following types and arguments are implemented (optional arguments in parenthesis)
2019-05-09 12:49:23 +00:00
```
2019-05-09 13:02:01 +00:00
"article"|"message" title message (markup description)
2019-05-09 12:49:23 +00:00
"photo" photo_URL (thumb_URL title description caption)
"gif" photo_URL (thumb_URL title caption)
"mpeg4_gif" mpeg_URL (thumb_URL title caption)
"video" video_URL mime_type thumb_URL title (caption)
"audio" audio_URL title (caption)
"voice" voice_URL title (caption)
"document" title document_URL mime_type (caption description)
"location" latitude longitude title
"venue" latitude longitude title (adress foursquare)
"contact" phone first (last thumb)
"cached_photo" file (title description caption)
"cached_gif" file (title caption)
"cached_mpeg4_gif" file (title caption)
"cached_sticker" file
"cached_document" title file (description caption)
"cached_video" file title (description caption)
"cached_voice" file title (caption)
"cached_audio" file title (caption)
```
2019-05-09 13:02:01 +00:00
see [InlineQueryResult for more information ](https://core.telegram.org/bots/api#inlinequeryresult ) about response types and their arguments.
2019-05-09 12:49:23 +00:00
----
### Background and Interactive jobs
You must include ```source modules/background.sh``` in 'commands.sh' to have the following functions availible.
2019-04-15 09:49:13 +00:00
2019-04-15 10:52:38 +00:00
##### startproc
2019-04-25 20:17:24 +00:00
```startproc``` starts a script, the output of the script is sent to the user or chat, user input will be sent back to the script. see [Advanced Usage ](3_advanced.md#Interactive-Chats )
2019-04-15 19:06:29 +00:00
2019-04-19 09:28:12 +00:00
*usage:* startproc "script"
2019-04-15 10:52:38 +00:00
*example:*
2019-04-15 19:06:29 +00:00
```bash
2019-04-19 09:28:12 +00:00
startproc 'examples/calc.sh'
2019-04-15 19:06:29 +00:00
```
2019-04-15 10:52:38 +00:00
##### checkproc
2019-04-25 20:17:24 +00:00
Return true (0) if an interactive script is running in the chat.
2019-04-15 19:06:29 +00:00
*usage:* checkprog
2019-04-15 09:49:13 +00:00
2019-04-15 10:52:38 +00:00
*example:*
2019-04-15 19:06:29 +00:00
```bash
checkproc
if [ "$res" -gt 0 ] ; then
2019-04-19 09:28:12 +00:00
startproc "examples/calc.sh"
2019-04-15 19:06:29 +00:00
else
send_normal_message "${CHAT[ID]}" "Calc already running ..."
fi
```
2019-04-15 09:49:13 +00:00
2019-04-15 10:52:38 +00:00
##### killproc
2019-04-25 20:17:24 +00:00
Kill the interactive script running in the chat
2019-04-15 19:06:29 +00:00
*usage:* killproc
2019-04-15 10:52:38 +00:00
*example:*
2019-04-15 19:06:29 +00:00
```bash
checkprog
if [ "$res" -eq 0 ]; then
killproc & & send_message "${CHAT[ID]}" "Command canceled."
else
send_message "${CHAT[ID]}" "Command is not running."
fi
```
2019-04-15 09:49:13 +00:00
----
2019-04-15 10:52:38 +00:00
##### background
2019-04-25 20:17:24 +00:00
Starts a script as a background job and attaches a jobname to it. All output from a background job is sent to the associated chat.
2019-04-16 11:29:49 +00:00
In contrast to interactive chats, background jobs do not recieve user input and can run forever. In addition you can suspend and restart running jobs, e.g. after reboot.
2019-04-19 09:28:12 +00:00
*usage:* background "script" "jobname"
2019-04-15 10:52:38 +00:00
*example:*
2019-04-15 19:06:29 +00:00
```bash
2019-04-19 09:28:12 +00:00
background "examples/notify.sh" "notify"
2019-04-15 19:06:29 +00:00
```
2019-04-15 10:52:38 +00:00
##### checkback
2019-04-16 14:45:26 +00:00
Return true (0) if an background job is active in the given chat.
2019-04-15 19:06:29 +00:00
*usage:* checkback "jobname"
2019-04-15 10:52:38 +00:00
*example:*
2019-04-15 19:06:29 +00:00
```bash
checkback "notify"
if [ "$res" -gt 0 ] ; then
send_normal_message "${CHAT[ID]}" "Start notify"
2019-04-19 09:28:12 +00:00
background "examples/notify.sh" "notify"
2019-04-15 19:06:29 +00:00
else
send_normal_message "${CHAT[ID]}" "Process notify already running."
fi
```
2019-04-15 09:49:13 +00:00
2019-04-15 10:52:38 +00:00
##### killback
2019-04-15 19:06:29 +00:00
*usage:* killback "jobname"
2019-04-15 09:49:13 +00:00
2019-04-15 10:52:38 +00:00
*example:*
2019-04-15 19:06:29 +00:00
```bash
checkback "notify"
if [ "$res" -eq 0 ] ; then
send_normal_message "${CHAT[ID]}" "Kill notify"
killback "notify"
else
send_normal_message "${CHAT[ID]}" "Process notify not run."
fi
```
2019-04-15 09:49:13 +00:00
2019-04-24 08:07:46 +00:00
----
##### send_message
```send_message``` sends any type of message to the given chat. Type of output is steered by keywords within the message.
The main use case for send_message is to process the output of interactive chats and background jobs. **For regular Bot commands I recommend using of the dedicated send_xxx_message() functions from above.**
*usage:* send_message "${CHAT[ID]}" "message"
*example:* - see [Usage ](2_usage.md#send_message ) and [Advanced Usage ](3_advanced.md#Interactive-Chats )
----
2019-05-10 10:04:49 +00:00
### Aliases - shortcuts for often used funtions
You must include ```source modules/aliases.sh``` in 'commands.sh' to have the following functions availible.
##### _is_botadmin
*usage:* _is_botadmin
*alias for:* user_is_botadmin "${USER[ID]}"
##### _is_admin
*usage:* _is_admin
*alias for:* user_is_admin "${CHAT[ID]}" "${USER[ID]}"
##### _is_allowed
*usage:* _is_allowed "what"
*alias for:* user_is_allowed "${USER[ID]}" "what" "${CHAT[ID]}"
----
##### _kick_user
*usage:* _kick_user "${USER[ID]}"
*alias for:* kick_chat_member "${CHAT[ID]}" "${USER[ID]}"
##### _unban
*usage:* _unban "${USER[ID]}"
*alias for:* unban_chat_member "${CHAT[ID]}" "${USER[ID]}"
##### _leave
*usage:* _leave
*alias for:* leave_chat "${CHAT[ID]}"
----
##### _message
*usage:* _message "message"
*alias for:* send_normal_message "${CHAT[ID]}" "message"
##### _normal_message
*usage:* _normal_message "message"
*alias for:* send_normal_message "${CHAT[ID]}" "message"
##### _html_message
*usage:* _html_message "message"
*alias for:* send_html_message "${CHAT[ID]}" "message"
##### _markdown_message
*usage:* _markdown_message "message"
*alias for:* send_markdown_message "${CHAT[ID]}" "message"
----
#### _inline_button
*usage:* _inline_button "${1}" "${2}"
*alias for:* send_inline_button "${CHAT[ID]}" "" "${1}" "${2}"
#### _inline_keyboard
*usage:* _inline_keyboard "${1}"
*alias for:* _inline_keyboard "${CHAT[ID]}" "" "${1}"
#### _keyboard_numpad
*usage:* _keyboard_numpad
*alias for:* send_keyboard "${CHAT[ID]}" "" '["1","2","3"],["4","5","6"],["7","8","9"],["-","0","."]' "yes"
#### _keyboard_yesno
*usage:* _keyboard_yesno
*alias for:* send_keyboard '["yes","no"]'
#### _del_keyboard
*usage:* _del_keyboard
*alias for:* remove_keyboard "${CHAT[ID]}" ""
2019-04-24 08:07:46 +00:00
### Helper functions
2019-04-25 20:17:24 +00:00
##### _is_function
2019-04-24 08:07:46 +00:00
Returns true if the given function exist, can be used to check if a module is loaded.
*usage* _is_function function
*example:*
```bash
_is_function "background" & & _message "you can run background jobs!"
```
----
2019-04-16 11:29:49 +00:00
### Bashbot internal functions
2019-04-15 12:17:18 +00:00
These functions are for internal use only and must not used in your bot commands.
2019-04-15 09:49:13 +00:00
2019-04-17 07:34:02 +00:00
##### get_file
*usage:* url="$(get_file "${CHAT[ID]}" "message")"
----
2019-04-15 10:52:38 +00:00
##### send_text
2019-04-15 19:06:29 +00:00
*usage:* send_text "${CHAT[ID]}" "message"
2019-04-15 10:52:38 +00:00
2019-04-15 09:49:13 +00:00
----
2019-04-15 10:52:38 +00:00
##### JsonDecode
2019-04-15 19:06:29 +00:00
Outputs decoded string to STDOUT
*usage:* JsonDecode "string"
2019-04-15 10:52:38 +00:00
##### JsonGetString
2019-04-15 19:06:29 +00:00
Reads JSON fro STDIN and Outputs found String to STDOUT
*usage:* JsonGetString `"path","to","string"`
2019-04-15 09:49:13 +00:00
2019-04-15 10:52:38 +00:00
##### JsonGetValue
2019-04-15 19:06:29 +00:00
Reads JSON fro STDIN and Outputs found Value to STDOUT
*usage:* JsonGetValue `"path","to","value"`
2019-04-15 10:52:38 +00:00
2019-04-15 09:49:13 +00:00
----
2019-04-15 10:52:38 +00:00
##### get_chat_member_status
2019-04-15 19:06:29 +00:00
*usage:* get_chat_member_status "${CHAT[ID]}" "${USER[ID]}"
2019-04-15 10:52:38 +00:00
2019-04-27 11:02:10 +00:00
this may get an official function ...
2019-04-15 09:49:13 +00:00
----
2019-04-15 10:52:38 +00:00
##### process_client
2019-04-15 12:17:18 +00:00
Every Message sent to your Bot is processd by this function. It parse the send JSON and assign the found Values to bash variables.
2019-04-15 10:52:38 +00:00
##### process_updates
2019-04-15 12:17:18 +00:00
If new updates are availible, this functions gets the JSON from Telegram and dispatch it.
2019-04-15 09:49:13 +00:00
----
2019-04-15 10:52:38 +00:00
##### getBotName
2019-04-15 12:17:18 +00:00
The name of your bot is availible as bash variable "$ME", there is no need to call this function if Bot is running.
2019-04-15 10:52:38 +00:00
2019-04-15 12:17:18 +00:00
*usage:* ME="$(getBotNiname)"
2019-04-15 10:52:38 +00:00
##### inproc
2019-04-15 12:17:18 +00:00
Send Input from Telegram to waiting Interactive Chat.
2019-04-15 09:49:13 +00:00
2019-04-16 14:45:26 +00:00
#### [Prev Best Practice](5_practice.md)
2019-04-23 09:45:03 +00:00
#### [Next Notes for Developers](7_develop.md)
2019-04-16 14:45:26 +00:00
2019-05-10 19:44:13 +00:00
#### $$VERSION$$ v0.80-dev2-1-g0b36bc5
2019-04-15 09:49:13 +00:00