1
0
mirror of https://github.com/danog/id3bot.git synced 2024-11-30 04:19:02 +01:00

Added easy way to start bot.

This commit is contained in:
Daniil Gentili 2016-04-17 14:13:28 +02:00
parent d13b6e25eb
commit c13d45b37b
2 changed files with 15 additions and 4 deletions

View File

@ -157,8 +157,8 @@ echo "Text that will appear in chat? mykeyboardstartshere \"Yep, sure\" \"No, hi
```
Once you're done editing start the bot with ```tmux new-session -d -s bashbot "./bashbot.sh"```.
To stop the bot run ```tmux kill-session -t bashbot```.
Once you're done editing start the bot with ```./bashbot.sh start```.
To stop the bot run ```./bashbot.sh kill```.
If some thing doesn't work as it should, debug with ```bash -x bashbot.sh```.
To use the functions provided in this script in other scripts source bashbot.sh: ```source bashbot.sh source```

View File

@ -13,6 +13,7 @@
# If you're in Europe, and public domain does not exist, then haha.
TOKEN='tokenhere'
TOKEN='197476763:AAGj-kg10J97h7t57DawEJYs_ljxKFuKaJ0'
URL='https://api.telegram.org/bot'$TOKEN
# Set INLINE to 1 in order to receive inline queries.
@ -367,7 +368,7 @@ Contribute to the project: https://github.com/topkecleon/telegram-bot-bash
}
# source the script with source as param to use functions in other scripts
while [ "$1" == "" ]; do {
while [ "$1" == "startbot" ]; do {
res=$(curl -s $UPD_URL$OFFSET | ./JSON.sh -s)
@ -400,5 +401,15 @@ case "$1" in
shift
for f in $(cat count);do send_message ${f//COUNT} "$*"; $sleep;done
;;
"start")
tmux kill-session -t $ME&>/dev/null
tmux new-session -d -s $ME "bash $SCRIPT startbot" && echo "Bot started successfully. Tmux session name is $ME" || echo "An error occurred while starting the bot."
;;
"kill")
tmux kill-session -t $ME &>/dev/null
echo "Bot was killed successfully. "
;;
"help")
cat README.md
;;
esac