diff --git a/README.md b/README.md index 0e07730..e366159 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,46 @@ Bashbot [Documentation](https://github.com/topkecleon/telegram-bot-bash) and [Do * Customize Bashbot Environment * [Examples](examples/README.md) +### Your really first bashbot in a nutshell +To install and run bashbot you need acess to a linux/unix/bsd command line. If you don't know how to get accces to a linux/unix/bsd like command line you should stop reading here :-( + +In addition you need a [Telegram client](https://telegram.org) and a mobile phone to [register an account](https://telegramguide.com/create-a-telegram-account/). +If you don't want to register for Telegram you should stop reading here ;-) + +After you're registered to Telegram send a message to [@botfather](https://telegram.me/botfather), +[create a new Telegram Bot token](doc/1_firstbot.md) and write it down. You need the token to install the bot. + +Now open a linux/unix/bsd terminal and check if bash is installed: ```which bash && echo "bash installed!"```. +If you get an error message bash is not installed. + +Create a new directory and change to it: ```mkdir tbb; cd tbb``` and download the latest '*.tar.gz' file from +[https://github.com/topkecleon/telegram-bot-bash/releases](https://github.com/topkecleon/telegram-bot-bash/releases). This can be done with the commands: +```bash +wget -q https://github.com/$(wget -q https://github.com/topkecleon/telegram-bot-bash/releases/latest -O - | egrep '/.*/.*/.*tar.gz' -o) +``` + +Extract the '*.tar.gz' file and change to bashbot directory: ```tar -xzf *.tar.gz; cd telegram-bot-bash```, +install bashbot: ```./bashbot.sh init``` and enter your bot token when asked. All other questions can be answered +by hitting the \ key. + +Thats all, now you can start your bot with ```./bashbot.sh start``` and send him messages: +``` +/start + +You are Botadmin +*Available commands*: +*• /start*: _Start bot and get this message_. +*• /help*: _Get this message_. +*• /info*: _Get shorter info message about this bot_.... + +/info + +his is bashbot, the Telegram bot written entirely in bash. +It features background tasks and interactive chats, and can serve as an interface for CLI programs. +``` +For more Information on how to install, customize and use your new bot, read the [Documentation](#Documentation) + +---- ## Security Considerations Running a Telegram Bot means it is connected to the public and you never know whats send to your Bot. diff --git a/db.json b/db.json new file mode 100644 index 0000000..a3df871 --- /dev/null +++ b/db.json @@ -0,0 +1,31 @@ +{ + "usage": + { + "ok":true, + "url":"https://my-json-server.typicode.com/topkecleon/telegram-bot-bash/", + "description":"Testing of JSON reponses for github.com/topkecleon/telegram-bot-bash" + } , + "false": + { + "ok":false, + "error_code":404, + "description":"Not Found" + } , + "ok": + { + "ok":true, + "description":"Ttest for ok" + } , + "getMe": + { + "ok":true, + "result": + { + "id":123456789, + "is_bot":true, + "first_name":"bashbot", + "username":"TestBotBash" + } + } + +} diff --git a/doc/6_reference.md b/doc/6_reference.md index 69cac30..91ab864 100644 --- a/doc/6_reference.md +++ b/doc/6_reference.md @@ -101,6 +101,13 @@ The main use case for send_message is to process the output of interactive chats ##### send_file 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) +Starting with version 0.80 send_file implements the following rules: + +- file names must not contain ".." +- file names must not start with "." +- file names not starting wit "/" are realtive to $TMPDIR, e.g. ./data-bot-bash +- abolute filenames must match $FILE_REGEX + *usage:* send_file "${CHAT[ID]}" "file" "caption" *example:*