From 474a0106709e6c7f58161f99ef1f9ec021ffc3d3 Mon Sep 17 00:00:00 2001 From: "Kay Marquardt (Gnadelwartz)" Date: Mon, 25 Mar 2019 11:11:22 +0100 Subject: [PATCH] fix restart in rc file, add init command to setup bashbot environment --- README.md | 17 ++++++++++++++--- bashbot.rc | 13 +++++++------ 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 52552d7..f0deee7 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,11 @@ A Telegram bot written in bash. Depends on [tmux](http://github.com/tmux/tmux). Uses [JSON.sh](http://github.com/dominictarr/JSON.sh). +Written by Drew (@topkecleon) and Daniil Gentili (@danogentili). +Also contributed: JuanPotato, BigNerd95, TiagoDanin, iicc1, Kay M (@gnadelwartz). + +[Download from github](https://github.com/topkecleon/telegram-bot-bash) + Released to the public domain wherever applicable. Elsewhere, consider it released under the [WTFPLv2](http://www.wtfpl.net/txt/copying/). @@ -69,13 +74,19 @@ group. This step is up to you actually. 13. @botfather replies with `Success! The new status is: DISABLED. /help` ### Install bashbot -Clone the repository: +1. Go to the directory you want to install bashbot, e.g. + + - your $HOME directory (install and run with your user-ID) + - /usr/local if you want to run as service + +2. Clone the repository: ``` git clone --recursive https://github.com/topkecleon/telegram-bot-bash ``` +3. Change to directory ```telegram-bot.bash``` and run ```./bashbot.sh init``` and follow the instructions. -Create a file called token and paste the token in there. -Then start editing the commands. + +Then start editing the commands.sh. ### Receive data You can read incoming data using the following variables: diff --git a/bashbot.rc b/bashbot.rc index 53d0fb9..a76bec9 100755 --- a/bashbot.rc +++ b/bashbot.rc @@ -11,7 +11,7 @@ ### END INIT INFO runas="root" # not recommended! -runcmd="echo" # not activated until you edit lines below +runcmd="echo" # not actived until you edit lines below # uncomment the next line to run as other user, e.g. www # runas="www" @@ -20,10 +20,10 @@ runcmd="echo" # not activated until you edit lines below # runcmd="su $runas -s /bin/bash -c " # runasuser with su # runcmd="runuser $runas -s /bin/bash -c " # runasuser with runuser -# uncomment and adjust the the values of the following lines -# start="/usr/local/telegram-bot-bash/bashbot.sh" -# lockfile=/usr/local/telegram-bot-bash/lockfile -# name='new-session' # telegram name of your bot +# adjust the the values of the following lines +start="/usr/local/telegram-bot-bash/bashbot.sh" +lockfile=/usr/local/telegram-bot-bash/lockfile +name='new-session' # telegram name of your bot case "$1" in @@ -52,11 +52,12 @@ case "$1" in fi ;; 'restart'|'reload') - $stop ; $start + $0 stop; $0 start RETVAL=$? ;; 'suspendback'|'resumeback'|'killback') $runcmd "$start $1" + RETVAL=$? ;; *) echo "Usage: $0 { start | stop | restart | reload | suspendback | resumeback | killback }"