mirror of
https://github.com/octoleo/telegram-bot-bash.git
synced 2024-12-28 20:52:36 +00:00
some typo, specify exit codes
This commit is contained in:
parent
92e9e9c3f5
commit
352c64fc32
@ -213,7 +213,7 @@ Allowed values: typing for text messages, upload_photo for photos, record_video
|
||||
send_action "${CHAT[ID]}" "action"
|
||||
```
|
||||
|
||||
#### Interactice Chats
|
||||
#### 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:
|
||||
@ -418,7 +418,7 @@ To use bashbot as a system servive include a working ```bashbot.rc``` in your in
|
||||
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```
|
||||
- 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```
|
||||
|
||||
|
||||
## Security Considerations
|
||||
@ -439,10 +439,10 @@ Everyone who can read your Bot files can extract your Bots data. Especially your
|
||||
Runing ```./bashbot init``` sets the Bot permissions to reasonable default values as a starting point.
|
||||
|
||||
### Is this Bot insecure?
|
||||
No - its not more or less insecure as any other Bot written in any other language. But you should know about the implications ...
|
||||
No - its not less (in)secure as any other Bot written in any other language. But you should know about the implications ...
|
||||
|
||||
## That's it!
|
||||
|
||||
If you feel that there's something missing or if you found a bug, feel free to submit a pull request!
|
||||
|
||||
#### $$VERSION$$ v0.5-rc-3-gf67503c
|
||||
#### $$VERSION$$ v0.5-rc-4-g92e9e9c
|
||||
|
@ -7,7 +7,7 @@
|
||||
# This file is public domain in the USA and all free countries.
|
||||
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
||||
#
|
||||
#### $$VERSION$$ v0.5-rc-3-gf67503c
|
||||
#### $$VERSION$$ v0.5-rc-4-g92e9e9c
|
||||
|
||||
|
||||
SHELL=/bin/sh
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
# description: Start or stop telegram-bash-bot
|
||||
#
|
||||
#### $$VERSION$$ v0.5-rc-3-gf67503c
|
||||
#### $$VERSION$$ v0.5-rc-4-g92e9e9c
|
||||
#
|
||||
### BEGIN INIT INFO
|
||||
# Provides: bashbot
|
||||
@ -13,7 +13,7 @@
|
||||
### END INIT INFO
|
||||
|
||||
runas="root" # not recommended!
|
||||
runcmd="echo" # not actived until you edit lines below
|
||||
runcmd="echo Dry run:" # not actived until you edit lines below
|
||||
|
||||
# uncomment the next line to run as other user, e.g. www
|
||||
# runas="nobody"
|
||||
|
22
bashbot.sh
22
bashbot.sh
@ -1,8 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
# bashbot, the Telegram bot written in bash.
|
||||
# Written by Drew (@topkecleon) and Daniil Gentili (@danogentili).
|
||||
# Also contributed: JuanPotato, BigNerd95, TiagoDanin, iicc1, Gnadelwartz.
|
||||
# Written by Drew (@topkecleon) and Daniil Gentili (@danogentili), KayM (@gnadelwartz).
|
||||
# Also contributed: JuanPotato, BigNerd95, TiagoDanin, iicc1.
|
||||
# https://github.com/topkecleon/telegram-bot-bash
|
||||
|
||||
# Depends on JSON.sh (http://github.com/dominictarr/JSON.sh) (MIT/Apache),
|
||||
@ -10,7 +10,14 @@
|
||||
# This file is public domain in the USA and all free countries.
|
||||
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
||||
#
|
||||
#### $$VERSION$$ v0.5-rc-3-gf67503c
|
||||
#### $$VERSION$$ v0.5-rc-4-g92e9e9c
|
||||
#
|
||||
# Exit Codes:
|
||||
# - 0 sucess (hopefully)
|
||||
# - 1 can't change to bashbot dir
|
||||
# - 2 can't write to tmp and / or count
|
||||
# - 3 user not found
|
||||
# - 4 unkown command
|
||||
|
||||
# are we runnig in a terminal?
|
||||
if [ -t 1 ] && [ "$TERM" != "" ]; then
|
||||
@ -56,7 +63,7 @@ elif [ ! -w "$TMPDIR" ]; then
|
||||
$CLEAR
|
||||
echo -e "${RED}ERROR: Can't write to $TMPDIR!.${NC}"
|
||||
ls -ld "$TMPDIR"
|
||||
exit 1
|
||||
exit 2
|
||||
fi
|
||||
|
||||
COUNT="./count"
|
||||
@ -66,7 +73,7 @@ elif [ ! -w "$COUNT" ]; then
|
||||
$CLEAR
|
||||
echo -e "${RED}ERROR: Can't write to $COUNT!.${NC}"
|
||||
ls -l "$COUNT"
|
||||
exit 1
|
||||
exit 2
|
||||
fi
|
||||
|
||||
|
||||
@ -551,7 +558,7 @@ case "$1" in
|
||||
[ "$TOUSER" = "" ] && TOUSER="$MYUSER"
|
||||
if ! compgen -u "$TOUSER" 2>&1 >/dev/null; then
|
||||
echo -e "${RED}User \"$TOUSER\" not found!${NC}"
|
||||
exit 2
|
||||
exit 3
|
||||
else
|
||||
echo "Adjusting user in bashbot.rc ..."
|
||||
sed -i '/^[# ]*runas=/ s/runas=.*$/runas="'$TOUSER'"/' bashbot.rc
|
||||
@ -611,16 +618,19 @@ case "$1" in
|
||||
"help")
|
||||
$CLEAR
|
||||
less "README.md"
|
||||
exit
|
||||
;;
|
||||
"attach")
|
||||
tmux attach -t "$ME"
|
||||
;;
|
||||
"source")
|
||||
echo "OK"
|
||||
exit
|
||||
;;
|
||||
*)
|
||||
echo -e "${RED}BAD REQUEST${NC}"
|
||||
echo -e "${RED}Available arguments: outproc, count, broadcast, start, suspendback, resumeback, kill, killback, help, attach${NC}"
|
||||
exit 4
|
||||
;;
|
||||
esac
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user