mirror of
https://github.com/octoleo/telegram-bot-bash.git
synced 2024-12-28 12:50:44 +00:00
split docs in sections final
This commit is contained in:
parent
9fd2f5ca0d
commit
4d5d38674d
11
README.md
11
README.md
@ -30,16 +30,17 @@ git clone --recursive https://github.com/topkecleon/telegram-bot-bash
|
||||
|
||||
|
||||
## Getting started
|
||||
(Create your first telegram bot)[doc/1_firstbot.md]
|
||||
(Make your own Bot)[doc/2_usage.md]
|
||||
[Create your first telegram bot](doc/1_firstbot.md)
|
||||
[Make your own Bot](doc/2_usage.md)
|
||||
Managing your own Bot
|
||||
Recieve data
|
||||
Send Messages
|
||||
(Advatage Features)[doc/3_advanced.md]
|
||||
Send files, location etc.
|
||||
[Advatage Features](doc/3_advanced.md)
|
||||
Interactive Chats
|
||||
Background Jobs
|
||||
Inline queries
|
||||
(Expert Use)[doc/4_expert.md]
|
||||
[Expert Use](doc/4_expert.md)
|
||||
Handling UTF-8
|
||||
Run as other user or system service
|
||||
Scedule bashbot from Cron
|
||||
@ -71,4 +72,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.50-11-g4ce19b1
|
||||
#### $$VERSION$$ v0.50-12-g9fd2f5c
|
||||
|
@ -1,6 +1,5 @@
|
||||
|
||||
## Instructions
|
||||
### Create your first bot
|
||||
## Create your first telegram bot
|
||||
|
||||
1. Message @botfather https://telegram.me/botfather with the following
|
||||
text: `/newbot`
|
||||
@ -71,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.50-11-g4ce19b1
|
||||
#### $$VERSION$$ v0.50-12-g9fd2f5c
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
## Creating your own Bot
|
||||
## Make your own Bot
|
||||
|
||||
All Commands for the Bot are in the ```commands.sh``` file (this should ease upgrades of the bot core). Here you find some examples how to process messages and send out text.
|
||||
|
||||
@ -9,7 +9,7 @@ To use the functions provided in this script in other scripts simply source bash
|
||||
|
||||
Have FUN!
|
||||
|
||||
## Managing your Bot
|
||||
## Managing your own Bot
|
||||
#### Note: running bashbot as root is highly danger and not recommended. See Expert use.
|
||||
|
||||
### Start / Stop
|
||||
@ -33,7 +33,7 @@ To send a broadcast to all of users that ever used the bot run the following com
|
||||
./bashbot.sh broadcast "Hey! I just wanted to let you know that the bot's been updated!"
|
||||
```
|
||||
|
||||
### Recieve data
|
||||
## Recieve data
|
||||
Evertime a Message is recieved, you can read incoming data using the following variables:
|
||||
|
||||
* ```$MESSAGE```: Incoming messages
|
||||
@ -81,7 +81,7 @@ Evertime a Message is recieved, you can read incoming data using the following v
|
||||
- ```${LOCATION[LONGITUDE]}```: Longitude
|
||||
- ```${LOCATION[LATITUDE]}```: Latitude
|
||||
|
||||
### Usage of bashbot functions
|
||||
## Usage of bashbot functions
|
||||
|
||||
#### send_message
|
||||
To send messages use the ```send_message``` function:
|
||||
@ -147,6 +147,6 @@ Allowed values: typing for text messages, upload_photo for photos, record_video
|
||||
send_action "${CHAT[ID]}" "action"
|
||||
```
|
||||
|
||||
#### $$VERSION$$ v0.50-11-g4ce19b1
|
||||
#### $$VERSION$$ v0.50-12-g9fd2f5c
|
||||
|
||||
|
||||
|
@ -1,4 +1,6 @@
|
||||
#### Interactive Chats
|
||||
|
||||
## Advanced Features
|
||||
### Interactive Chats
|
||||
To create interactive chats, write (or edit the question script) a normal bash (or C or python) script, chmod +x it and then change the argument of the startproc function to match the command you usually use to start the script.
|
||||
The text that the script will output will be sent in real time to the user, and all user input will be sent to the script (as long as it's running or until the user kills it with /cancel).
|
||||
To open up a keyboard in an interactive script, print out the keyboard layout in the following way:
|
||||
@ -29,7 +31,7 @@ echo "Text that will appear in one message mynewlinestartshere with this text
|
||||
```
|
||||
Note: Interactive Chats run independent from main bot and continue running until your script exits or you /cancel if from your Bot.
|
||||
|
||||
#### Background Jobs
|
||||
### Background Jobs
|
||||
|
||||
A background job is similar to an interactive chat, but runs in the background and does only output massages instead of processing input from the user. In contrast to interactive chats it's possible to run multiple background jobs. To create a background job write a script or edit the notify script and use the funtion ```background``` to start it:
|
||||
```bash
|
||||
@ -52,7 +54,7 @@ If you want to kill all background jobs permantly run:
|
||||
```
|
||||
Note: Background Jobs run independent from main bot and continue running until your script exits or you stop if from your Bot. Backgound Jobs will continue running if your Bot is stoped (kill)!.
|
||||
|
||||
#### Inline queries
|
||||
### Inline queries
|
||||
The following commands allows users to interact with your bot via *inline queries*.
|
||||
In order to enable **inline mode**, send `/setinline` command to [@BotFather](https://telegram.me/botfather) and provide the placeholder text that the user will see in the input field after typing your bot’s name.
|
||||
Also, edit line 12 from `commands.sh` putting a "1".
|
||||
@ -95,5 +97,5 @@ To send stickers through an *inline query*:
|
||||
answer_inline_query "$iQUERY_ID" "cached_sticker" "identifier for the sticker"
|
||||
```
|
||||
|
||||
#### $$VERSION$$ v0.50-11-g4ce19b1
|
||||
#### $$VERSION$$ v0.50-12-g9fd2f5c
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
## Handling UTF-8 character sets
|
||||
### Setting up your Environment
|
||||
## Expert Use
|
||||
|
||||
### Handling UTF-8 character sets
|
||||
#### Setting up your Environment
|
||||
In general ```bash``` and ```GNU``` utitities are UTF-8 aware, but you have to setup your environment
|
||||
and your scripts accordingly:
|
||||
|
||||
@ -28,7 +30,7 @@ export 'LANGUAGE=den_US.UTF-8'
|
||||
|
||||
To display all availible locales on your system run ```locale -a | more```. [Gentoo Wiki](https://wiki.gentoo.org/wiki/UTF-8)
|
||||
|
||||
### UTF-8 in Telegram
|
||||
#### UTF-8 in Telegram
|
||||
```UTF-8``` is a variable length encoding of Unicode. UTF-8 is recommended as the default encoding in JSON, XML and HTML, also Telegram make use of it.
|
||||
|
||||
The first 128 characters are regular ASCII, so it's a superset of and compatible with ASCII environments. The next 1,920 characters need
|
||||
@ -44,11 +46,11 @@ E.g. the Emoticons ``` 😁 😘 ❤️ 😊 👍 ``` are encoded as:
|
||||
'\uXXXX' and '\UXXXXXXXX' escaped endocings are supported by zsh, bash, ksh93, mksh and FreeBSD sh, GNU 'printf' and GNU 'echo -e', see [this Stackexchange Answer](https://unix.stackexchange.com/questions/252286/how-to-convert-an-emoticon-specified-by-a-uxxxxx-code-to-utf-8/252295#252295) for more information.
|
||||
|
||||
|
||||
## Expert Use
|
||||
Bashbot is desingned to run manually by the user who installed it. Nevertheless it's possible to run it by an other user-ID, as a system service or sceduled from cron. This is onyl recommended for experiend linux users.
|
||||
|
||||
### Run as other user or system service
|
||||
Running bashbot as an other user is only possible with sudo rigths.
|
||||
Bashbot is desingned to run manually by the user who installed it. Nevertheless it's possible to run it by an other user-ID, as a system service or sceduled from cron. This is onyl recommended for experiend linux users.
|
||||
|
||||
####Running bashbot as an other user is only possible with sudo rigths.
|
||||
|
||||
Setup the environment for the user you want to run bashbot and enter desired username, e.g. nobody :
|
||||
```bash
|
||||
@ -99,5 +101,5 @@ An example crontab is provided in ```bashbot.cron```.
|
||||
- If you are running bashbot with your user-ID, copy the examples lines to your crontab and remove username ```nobody```.
|
||||
- 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.50-11-g4ce19b1
|
||||
#### $$VERSION$$ v0.50-12-g9fd2f5c
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user