telegram-bot-bash/examples/README.md

66 lines
2.4 KiB
Markdown
Raw Normal View History

2019-04-29 17:34:47 +00:00
#### [Home](../README.md)
## Bashbot examples
2019-05-01 12:29:57 +00:00
### bashbot multi
An example wrapper to run multiple instances of bashbot, use ```./bashbot-multi.sh botname command```
2019-04-29 17:34:47 +00:00
### bashbot.cron
An example crontab is provided in ```examples/bashbot.cron```, see [Expert use](../doc/4_expert.md#Scedule-bashbot-from-Cron)
### Interactive chats
Two examples for interactive scripts are provided as **calc.sh** and **question.sh**, see [Advanced use](../doc/3_advanced.md#Interactive-Chats)
2019-04-29 17:34:47 +00:00
### Background scripts
2019-04-29 17:34:47 +00:00
Background jobs are an easy way to provide sceduled messages or alerts if something happens.
2019-04-30 12:21:24 +00:00
**notify.sh** is a simple example on how to send a message every x seonds, e.g. current time.
2019-04-29 17:34:47 +00:00
2020-06-23 14:35:50 +00:00
**background-scripts** contains a more useful example on how to start and stop different scripts plus some example background scripts.
2019-04-29 17:34:47 +00:00
```
2020-06-23 14:35:50 +00:00
mycommands.sh - /run_xxx and /kill-xxx will start any script named run_xxx.sh
2019-04-29 17:34:47 +00:00
run_diskusage.sh - shows disk usage every 100 seconds
run_filename.sh - shown the name of new files in a named dir
2019-04-29 17:34:47 +00:00
run_filecontent.sh - shown the content of new files in a named dir
run_notify.sh - same as notify.sh
```
2019-04-30 12:21:24 +00:00
**Note:** Output of system commands often contains newlines, each newline results in a telegram message, the function 'send_telegram' in
mycommands.sh avoids this by converting each newline to ' mynewlinestartshere ' before output the string.
2019-04-29 17:34:47 +00:00
2019-05-01 10:37:18 +00:00
### System Status
**send-system-status** contains an example for commands showing status of different subsystems. This example is adapted from
https://github.com/RG72/telegram-bot-bash to current bashbot commands, but not fully tested. This will show how easy you can
convert existing bots.
2019-04-30 13:48:55 +00:00
```
mycommands.sh - commands to show system status
2019-04-30 13:48:55 +00:00
botacl - controls who can show system status
2020-06-23 14:35:50 +00:00
*Available commands*:
/se *sensors*
/smb *smbstatus*
/free *memory status*
/md *raid status*
/lvm *lvm status*
/lvsd *Datailed lvm status*
/df *disk space*
/ifconfig *ifconfig output*
/smart *sda* _smart status for sda drive_
2019-04-30 13:48:55 +00:00
```
### jsonDB and Keyboards
2019-04-29 17:34:47 +00:00
**jsonDB-keybords** contains a stripped down real world example from my bot showing the usage of jsonDB to store and retrieve values
plus use of keyboards in private chats. It's an extended version of mycommands.sh.dist. Messages and help are in german.
2019-04-29 17:34:47 +00:00
2021-01-30 20:36:38 +00:00
### Webhook
**Webhook** contains instructions on how use webhook API to get updates from telegram instead polling Telegram server.
2021-06-03 12:21:40 +00:00
#### $$VERSION$$ v1.51-0-g6e66a28
2019-04-29 17:34:47 +00:00