telegram-bot-bash/doc/6_reference.md

218 lines
3.2 KiB
Markdown
Raw Normal View History

2019-04-15 09:49:13 +00:00
## Bashbot functions reference
### Send, forward, delete Messages
2019-04-15 10:52:38 +00:00
##### send_action
2019-04-15 17:13:39 +00:00
To send a chat action use the send_action function. Allowed values: ```typing``` for text messages, ```upload_photo``` for photos, ```record_video``` or ```upload_video``` for videos, ```record_audio``` or ```upload_audio``` for audio files, ```upload_document``` for general files, ```find_location``` for locations.
*usage:* send_action "${CHAT[ID]}" "action"
2019-04-15 09:49:13 +00:00
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
*usage:*
2019-04-15 09:49:13 +00:00
2019-04-15 10:52:38 +00:00
*example:*
2019-04-15 09:49:13 +00:00
2019-04-15 10:52:38 +00:00
##### send_markdown_message
*usage:*
*example:*
##### send_html_message
*usage:*
*example:*
##### forward
*usage:*
*example:*
2019-04-15 09:49:13 +00:00
----
2019-04-15 10:52:38 +00:00
##### send_message
2019-04-15 12:17:18 +00:00
Send Message must (only) used to process the output of interactive chats and background jobs.
**For your commands I reccommend the more dedicated send_xxx_message() functions above.**
2019-04-15 10:52:38 +00:00
*usage:*
2019-04-15 12:17:18 +00:00
*example:* - see [Usage](2_usage.md#send_message) and [Advanced Usage](3_advanced.md#Interactive-Chats)
2019-04-15 09:49:13 +00:00
----
2019-04-15 10:52:38 +00:00
##### delete_message
*usage:*
*example:*
2019-04-15 09:49:13 +00:00
----
2019-04-15 10:52:38 +00:00
##### answer_inline_query
*usage:*
*example:*
2019-04-15 09:49:13 +00:00
----
### File, Location, Venu, keyboards
2019-04-15 10:52:38 +00:00
##### get_file
*usage:*
*example:*
2019-04-15 09:49:13 +00:00
2019-04-15 10:52:38 +00:00
##### send_file
*usage:*
2019-04-15 09:49:13 +00:00
2019-04-15 10:52:38 +00:00
*example:*
2019-04-15 09:49:13 +00:00
2019-04-15 10:52:38 +00:00
##### send_location
*usage:*
*example:*
##### send_venue
*usage:*
*example:*
2019-04-15 09:49:13 +00:00
----
2019-04-15 10:52:38 +00:00
##### send_keyboard
2019-04-15 17:13:39 +00:00
Note: since version 0.6 send_keyboard was changed to use native "JSON Array" as used from Telegram.
*usage:* send_keyboard "chat-id" "keyboard"
2019-04-15 10:52:38 +00:00
*example:*
2019-04-15 17:13:39 +00:00
```bash
send_keyboard "${CHAT[ID]}" "[ \"yes\" , \"no\" ]"
send_keyboard "${CHAT[ID]}" "[ \"yes\" ] , [ \"no\" ]"
send_keyboard "${CHAT[ID]}" "[ \"1\" , \"2\" , \"3\" ] , [ \"4\" , \"5\" , \"6\" ] , [ \"7\" , \"8\" , \"9\" ] , [ \"0\" ]"
```
2019-04-15 10:52:38 +00:00
##### remove_keyboard
*usage:*
2019-04-15 09:49:13 +00:00
2019-04-15 10:52:38 +00:00
*example:*
2019-04-15 09:49:13 +00:00
### Manage users
2019-04-15 10:52:38 +00:00
##### kick_chat_member
*usage:*
2019-04-15 09:49:13 +00:00
2019-04-15 10:52:38 +00:00
*example:*
2019-04-15 09:49:13 +00:00
2019-04-15 10:52:38 +00:00
##### unban_chat_member
*usage:*
*example:*
##### leave_chat
*usage:*
*example:*
2019-04-15 09:49:13 +00:00
----
2019-04-15 10:52:38 +00:00
##### user_is_creator
*usage:*
*example:*
2019-04-15 09:49:13 +00:00
2019-04-15 10:52:38 +00:00
##### user_is_admin
*usage:*
2019-04-15 09:49:13 +00:00
2019-04-15 10:52:38 +00:00
*example:*
2019-04-15 09:49:13 +00:00
2019-04-15 10:52:38 +00:00
##### user_is_botadmin
*usage:*
*example:*
##### user_is_allowed
*usage:*
*example:*
2019-04-15 09:49:13 +00:00
### Interactive and backgound jobs
2019-04-15 10:52:38 +00:00
##### startproc
*usage:*
*example:*
##### checkproc
*usage:*
2019-04-15 09:49:13 +00:00
2019-04-15 10:52:38 +00:00
*example:*
2019-04-15 09:49:13 +00:00
2019-04-15 10:52:38 +00:00
##### killproc
*usage:*
*example:*
2019-04-15 09:49:13 +00:00
----
2019-04-15 10:52:38 +00:00
##### background
*usage:*
*example:*
##### checkback
*usage:*
*example:*
2019-04-15 09:49:13 +00:00
2019-04-15 10:52:38 +00:00
##### killback
*usage:*
2019-04-15 09:49:13 +00:00
2019-04-15 10:52:38 +00:00
*example:*
2019-04-15 09:49:13 +00:00
### Bashbot internal
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-15 10:52:38 +00:00
##### send_text
*usage:*
2019-04-15 09:49:13 +00:00
----
2019-04-15 10:52:38 +00:00
##### JsonDecode
*usage:*
##### JsonGetString
*usage:*
2019-04-15 09:49:13 +00:00
2019-04-15 10:52:38 +00:00
##### JsonGetValue
*usage:*
2019-04-15 09:49:13 +00:00
----
2019-04-15 10:52:38 +00:00
##### get_chat_member_status
*usage:*
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-15 15:44:04 +00:00
#### $$VERSION$$ v0.6-rc1-11-gba80ec6
2019-04-15 09:49:13 +00:00