adjust documentation

This commit is contained in:
Kay Marquardt (Gnadelwartz) 2019-05-10 12:04:49 +02:00
parent 73b7734fa3
commit a51f8ca150
5 changed files with 141 additions and 86 deletions

View File

@ -61,7 +61,13 @@
<li>Seperate logic from commands</li> <li>Seperate logic from commands</li>
<li>Test your Bot with shellcheck</li> <li>Test your Bot with shellcheck</li>
</ul></li> </ul></li>
<li><a href="doc/6_reference.md">Bashbot function reference</a></li> <li><a href="doc/6_reference.md">Function Reference</a>
<ul>
<li>Sending Messages, Files, Keyboards</li>
<li>User Access Control</li>
<li>Inline Queries</li>
<li>Background and Interactive Jobs</li>
</ul></li>
<li><a href="doc/7_develop.md">Deveoper Notess</a> <li><a href="doc/7_develop.md">Deveoper Notess</a>
<ul> <ul>
<li>Setup your environment</li> <li>Setup your environment</li>
@ -97,6 +103,6 @@
<p><span class="citation">@Gnadelwartz</span></p> <p><span class="citation">@Gnadelwartz</span></p>
<h2 id="thats-it">Thats it!</h2> <h2 id="thats-it">Thats it!</h2>
<p>If you feel that theres something missing or if you found a bug, feel free to submit a pull request!</p> <p>If you feel that theres something missing or if you found a bug, feel free to submit a pull request!</p>
<h4 id="version-v0.72-dev-0-g6afa177"><br /><span class="math display"><em>V</em><em>E</em><em>R</em><em>S</em><em>I</em><em>O</em><em>N</em></span><br /> v0.72-dev-0-g6afa177</h4> <h4 id="version-v0.72-dev-5-g73b7734"><br /><span class="math display"><em>V</em><em>E</em><em>R</em><em>S</em><em>I</em><em>O</em><em>N</em></span><br /> v0.72-dev-5-g73b7734</h4>
</body> </body>
</html> </html>

View File

@ -44,7 +44,11 @@ Bashbot [Documentation](https://github.com/topkecleon/telegram-bot-bash) and [Do
* Customize commands.sh * Customize commands.sh
* Seperate logic from commands * Seperate logic from commands
* Test your Bot with shellcheck * Test your Bot with shellcheck
* [Bashbot function reference](doc/6_reference.md) * [Function Reference](doc/6_reference.md)
* Sending Messages, Files, Keyboards
* User Access Control
* Inline Queries
* Background and Interactive Jobs
* [Deveoper Notess](doc/7_develop.md) * [Deveoper Notess](doc/7_develop.md)
* Setup your environment * Setup your environment
* Test, Add, Push changes * Test, Add, Push changes
@ -94,4 +98,4 @@ Well, thats a damn good question ... may be because I'm an Unix/Linux admin from
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.72-dev-0-g6afa177 #### $$VERSION$$ v0.72-dev-5-g73b7734

View File

@ -51,7 +51,11 @@ all](https://core.telegram.org/bots#3-how-do-i-create-a-bot)
* Customize commands.sh * Customize commands.sh
* Seperate logic from commands * Seperate logic from commands
* Test your Bot with shellcheck * Test your Bot with shellcheck
* [Bashbot function reference](doc/6_reference.md) * [Function Reference](doc/6_reference.md)
* Sending Messages, Files, Keyboards
* User Access Control
* Inline Queries
* Background and Interactive Jobs
* [Deveoper Notess](doc/7_develop.md) * [Deveoper Notess](doc/7_develop.md)
* Setup your environment * Setup your environment
* Test, Add, Push changes * Test, Add, Push changes
@ -133,4 +137,4 @@ health status
If you feel that there's something missing or if you found a bug, feel free to If you feel that there's something missing or if you found a bug, feel free to
submit a pull request! submit a pull request!
#### $$VERSION$$ v0.72-dev-0-g6afa177 #### $$VERSION$$ v0.72-dev-5-g73b7734

View File

@ -10,6 +10,8 @@
*"action":* ```typing```, ```upload_photo```, ```record_video```, ```upload_video```, ```record_audio```, ```upload_audio```, ```upload_document```, ```find_location```. *"action":* ```typing```, ```upload_photo```, ```record_video```, ```upload_video```, ```record_audio```, ```upload_audio```, ```upload_document```, ```find_location```.
*alias:* _action "action"
*example:* *example:*
```bash ```bash
send_action "${CHAT[ID]}" "typing" send_action "${CHAT[ID]}" "typing"
@ -22,6 +24,8 @@ send_action "${CHAT[ID]}" "record_audio"
*usage:* send_normal_message "${CHAT[ID]}" "message" *usage:* send_normal_message "${CHAT[ID]}" "message"
*alias:* _normal_message "message"
*example:* *example:*
```bash ```bash
send_normal_message "${CHAT[ID]}" "this is a text message" send_normal_message "${CHAT[ID]}" "this is a text message"
@ -34,6 +38,8 @@ Telegram supports a [reduced set of Markdown](https://core.telegram.org/bots/api
*usage:* send_markdown_message "${CHAT[ID]}" "markdown message" *usage:* send_markdown_message "${CHAT[ID]}" "markdown message"
*alias:* _markdown "message"
*example:* *example:*
```bash ```bash
send_markdown_message "${CHAT[ID]}" "this is a markdown message, next word is *bold*" send_markdown_message "${CHAT[ID]}" "this is a markdown message, next word is *bold*"
@ -46,6 +52,8 @@ Telegram supports a [reduced set of HTML](https://core.telegram.org/bots/api#htm
*usage:* send_html_message "${CHAT[ID]}" "html message" *usage:* send_html_message "${CHAT[ID]}" "html message"
*alias:* _html_message "message"
*example:* *example:*
```bash ```bash
send_normal_message "${CHAT[ID]}" "this is a markdown message, next word is <b>bold</b>" send_normal_message "${CHAT[ID]}" "this is a markdown message, next word is <b>bold</b>"
@ -59,6 +67,8 @@ send_normal_message "${CHAT[ID]}" "<b>bold</b> <i>italic><i> <em>italic>/em> <a
*old call:* forward "${CHAT[ID]}" "$FROMCHAT" "${MESSAGE[ID]}" *old call:* forward "${CHAT[ID]}" "$FROMCHAT" "${MESSAGE[ID]}"
*alias:* _forward "$FROMCHAT" "${MESSAGE[ID]}"
See also [Text formating options](https://core.telegram.org/bots/api#formatting-options) See also [Text formating options](https://core.telegram.org/bots/api#formatting-options)
---- ----
@ -68,6 +78,8 @@ If your Bot is admin of a Chat he can delete every message, if not he can delete
*usage:* delete_message "${CHAT[ID]}" "${MESSAGE[ID]}" *usage:* delete_message "${CHAT[ID]}" "${MESSAGE[ID]}"
*alias:* _del_message "${MESSAGE[ID]}"
See also [deleteMessage limitations](https://core.telegram.org/bots/api#deletemessage) See also [deleteMessage limitations](https://core.telegram.org/bots/api#deletemessage)
---- ----
@ -109,6 +121,8 @@ Note: since version 0.6 send_keyboard was changed to use native "JSON Array" not
*usage:* send_keyboard "chat-id" "message" "keyboard" *usage:* send_keyboard "chat-id" "message" "keyboard"
*alias:* _keyboard "message" "keyboard"
*example:* *example:*
```bash ```bash
send_keyboard "${CHAT[ID]}" "Say yes or no" "[ \\"yes\" , \\"no\" ]"" send_keyboard "${CHAT[ID]}" "Say yes or no" "[ \\"yes\" , \\"no\" ]""
@ -119,6 +133,8 @@ send_keyboard "${CHAT[ID]}" "Enter digit" "[ \\"1\\" , \\"2\\" , \\"3\\" ] , [ \
##### remove_keyboard ##### remove_keyboard
*usage:* remove_keybord "$CHAT[ID]" "message" *usage:* remove_keybord "$CHAT[ID]" "message"
*alias:* _del_keyboard "message"
*See also: [Keyboard Markup](https://core.telegram.org/bots/api/#replykeyboardmarkup)* *See also: [Keyboard Markup](https://core.telegram.org/bots/api/#replykeyboardmarkup)*
---- ----
@ -155,7 +171,7 @@ send_inline_keyboard "${CHAT[ID]}" "" '[{"text":"b 1", url"":"u 1"}, {"text":"b
---- ----
### Manage users ### User Access Control
##### kick_chat_member ##### kick_chat_member
If your Bot is a chat admin he can kick and ban a user. If your Bot is a chat admin he can kick and ban a user.
@ -189,14 +205,12 @@ fi
---- ----
### User Access Control
##### user_is_botadmin ##### user_is_botadmin
Return true (0) if user is admin of bot, user id if botadmin is read from file './botadmin'. Return true (0) if user is admin of bot, user id if botadmin is read from file './botadmin'.
*usage:* user_is_botadmin "${USER[ID]}" *usage:* user_is_botadmin "${USER[ID]}"
*modules/alias:* _is_botadmin *alias:* _is_botadmin
*example:* *example:*
```bash ```bash
@ -208,14 +222,14 @@ Return true (0) if user is creator of given chat or chat is a private chat.
*usage:* user_is_creator "${CHAT[ID]}" "${USER[ID]}" *usage:* user_is_creator "${CHAT[ID]}" "${USER[ID]}"
*modules/alias:* _is_creator *alias:* _is_creator
##### user_is_admin ##### user_is_admin
Return true (0) if user is admin or creator of given chat. Return true (0) if user is admin or creator of given chat.
*usage:* user_is_admin "${CHAT[ID]}" "${USER[ID]}" *usage:* user_is_admin "${CHAT[ID]}" "${USER[ID]}"
*modules/alias:* _is_admin *alias:* _is_admin
*example:* *example:*
```bash ```bash
@ -313,75 +327,6 @@ see [InlineQueryResult for more information](https://core.telegram.org/bots/api#
---- ----
### 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"
----
### Background and Interactive jobs ### Background and Interactive jobs
You must include ```source modules/background.sh``` in 'commands.sh' to have the following functions availible. You must include ```source modules/background.sh``` in 'commands.sh' to have the following functions availible.
@ -482,6 +427,102 @@ The main use case for send_message is to process the output of interactive chats
---- ----
### 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]}" ""
### Helper functions ### Helper functions
##### _is_function ##### _is_function
@ -551,5 +592,5 @@ Send Input from Telegram to waiting Interactive Chat.
#### [Prev Best Practice](5_practice.md) #### [Prev Best Practice](5_practice.md)
#### [Next Notes for Developers](7_develop.md) #### [Next Notes for Developers](7_develop.md)
#### $$VERSION$$ v0.72-dev-1-g9b85000 #### $$VERSION$$ v0.72-dev-5-g73b7734

View File

@ -7,13 +7,13 @@ bashbot development is done on github. If you want to provide fixes or new featu
### Debuging Bashbot ### Debuging Bashbot
In normal mode of operation all bashbot output is discarded one more correct sent to TMUX console. In normal mode of operation all bashbot output is discarded one more correct sent to TMUX console.
To get these messages (and more) you can start bashbot in the current shell ```./bashbot.sh startbot```. Now you can see all output or erros from bashbot. To get these messages (and more) you can start bashbot in the current shell ```./bashbot.sh startbot```. Now you can see all output or erros from bashbot.
In addition you can change the change the level of verbosity by adding a third argumant. In addition you can change the change the level of verbosity by adding a third argument after startbot.
``` ```
"debug" redirects all output to "DEBUG.log", in addtion every update is logged in "MESSAGE.LOG" and "INLINE.log" "debug" redirects all output to "DEBUG.log", in addtion every update is logged in "MESSAGE.LOG" and "INLINE.log"
"debugterm same as debug but output and errors are sent to terminal "debugterm" same as debug but output and errors are sent to terminal
"xdebug" same as debug plus set bash option '-x' to log any executed command "xdebug" same as debug plus set bash option '-x' to log any executed command
"xdebugterm" same as xdebug, but output and errors are sent to terminal "xdebugterm" same as xdebug but output and errors are sent to terminal
``` ```
@ -131,5 +131,5 @@ fi
#### [Prev Function Reference](6_reference.md) #### [Prev Function Reference](6_reference.md)
#### [Next Bashbot Environment](8_custom.md) #### [Next Bashbot Environment](8_custom.md)
#### $$VERSION$$ v0.72-dev-4-gbf00d33 #### $$VERSION$$ v0.72-dev-5-g73b7734