From d8f8d73dbcf3631bdb030b2472a90d8545521a2f Mon Sep 17 00:00:00 2001 From: celso Date: Tue, 28 Mar 2023 14:56:52 -0300 Subject: [PATCH] updated README.md --- README.md | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 40f57ec..ce9cefa 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ bashbot-lib provides generic functionality for telegram bots made in bash
with this library you will be able to run a telegram bot with few dependencies
**IMPORTANT**: bashbot-lib uses the getUpdates method with tcp_keepalive, not webhooks
**IMPORTANT**: bashbot-lib is not made for asynchronous use, only one message is received at a time and is done so in order
- +[TOC2] ## license this program is licensed under the **Affero GNU Public License v3**, you can read the copy that comes along with this program or read it at [gnu.org's website](http://www.gnu.org/licenses/agpl-3.0.html) @@ -58,9 +58,9 @@ the `getmsg_content` receives two arguments **IMPORANT**: you must pass only the name of the associative array and not a reference to it ``` # wrong way -getmsg_content ${curmsg} updates.txt +getmsg_content "${curmsg}" "updates.txt" # right way -getmsg_content curmsg updates.txt +getmsg_content "curmsg" "updates.txt" ``` this is so because bash associative arrays can only be passed to functions as named references @@ -81,14 +81,14 @@ the bash associative array will hold the following contents | text | may contain special symbols | | callback | callback_data, empty if there is none | -if you sourced the viewer, you can view these contents with `view_content curmsg` where `curmsg` is the name of the bash associative array populated by `getmsg_content` +if you sourced the viewer, you can view these contents with `view_content "curmsg"` where `curmsg` is the name of the bash associative array populated by `getmsg_content` ### sending messages use the `sendmsg` function to send messages and print the result to `sentmsgs.txt` the `sendmsg` function takes up to three arguments * the chat_id of the chat to send the message to -* the contents of the message (text only for this version) +* the contents of the message (text only for this version, support for images and media will come in future versions) * (optional) an inline keyboard made with `mkinline_kbd` **IMPORTANT**: you must [URL % encode](https://www.w3schools.com/tags/ref_urlencode.ASP) some special characters in the contents of the message or telegram won't accept them @@ -151,7 +151,7 @@ declare -a kbd_rows=( 1 3 3) declare -a kbd_text=( "apple" "orange" "banana" "peach" "cherry" "pear" "lemon" ) declare -a kbd_data=( "red" "orange" "yellow" "orange" "red" "green" "yellow" ) -mkinline_kbd kbd_rows kbd_text kbd_data +mkinline_kbd "kbd_rows" "kbd_text" "kbd_data" ``` will result in ``` @@ -159,4 +159,14 @@ will result in ``` if you use this with sendmsg, the keyboard will look like this -![why are you blind](./images/example1.png "example 1 image") +![why are you blind](https://i.imgur.com/IRC2lhk.png "example 1 image") + +## acknowledgements +bash manpage +sed manpage +grep manpage +telegram bot api reference +stackoverflow + +## bug-reporting +send me an email at celsochan@disroot.org with the contents of error.log and a description of your issue with reproduction steps if possible