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:
parent
d13b6e25eb
commit
c13d45b37b
@ -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"```.
|
Once you're done editing start the bot with ```./bashbot.sh start```.
|
||||||
To stop the bot run ```tmux kill-session -t bashbot```.
|
To stop the bot run ```./bashbot.sh kill```.
|
||||||
If some thing doesn't work as it should, debug with ```bash -x bashbot.sh```.
|
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```
|
To use the functions provided in this script in other scripts source bashbot.sh: ```source bashbot.sh source```
|
||||||
|
15
bashbot.sh
15
bashbot.sh
@ -13,6 +13,7 @@
|
|||||||
# If you're in Europe, and public domain does not exist, then haha.
|
# If you're in Europe, and public domain does not exist, then haha.
|
||||||
|
|
||||||
TOKEN='tokenhere'
|
TOKEN='tokenhere'
|
||||||
|
TOKEN='197476763:AAGj-kg10J97h7t57DawEJYs_ljxKFuKaJ0'
|
||||||
URL='https://api.telegram.org/bot'$TOKEN
|
URL='https://api.telegram.org/bot'$TOKEN
|
||||||
|
|
||||||
# Set INLINE to 1 in order to receive inline queries.
|
# 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
|
# 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)
|
res=$(curl -s $UPD_URL$OFFSET | ./JSON.sh -s)
|
||||||
|
|
||||||
@ -400,5 +401,15 @@ case "$1" in
|
|||||||
shift
|
shift
|
||||||
for f in $(cat count);do send_message ${f//COUNT} "$*"; $sleep;done
|
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
|
esac
|
||||||
|
Loading…
Reference in New Issue
Block a user