From a29fd2604675ccef8a0e114273835ea386110b7f Mon Sep 17 00:00:00 2001 From: profitroll Date: Tue, 9 Aug 2022 12:30:36 +0200 Subject: [PATCH] Added start scripts --- README.md | 10 +++++++++- loop.bat | 12 ++++++++++++ loop.sh | 17 +++++++++++++++++ start.bat | 6 ++++++ start.sh | 6 ++++++ 5 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 loop.bat create mode 100644 loop.sh create mode 100644 start.bat create mode 100644 start.sh diff --git a/README.md b/README.md index 06b9b4b..b0f339d 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,12 @@ This bot is used for one and only task - post pictures from my personal archive. ## Installation To make this bot run at first you need to have a Python interpreter and git. Google is your friend finding it. You can also ignore git and simply download source code, should also work fine. After that you're ready to go. +> In this README I assume that you're using default python in your +> system and your system's PATH contains it. If your default python +> is `python3` or for example `/home/user/.local/bin/python3.9` - use it instead. +> If it's non-standart executable path - you should also change +> it in scripts you will use (`loop.sh`, `loop.bat`, `start.sh` and `start.bat`). + 1. Download the bot. 1. `git clone https://git.end-play.xyz/profitroll/TelegramSender.git` (if you want to use git) 2. `cd ./TelegramSender` @@ -28,7 +34,9 @@ To make this bot run at first you need to have a Python interpreter and git. Goo Of course bot cannot post something from nothing. Configure your `config.json` what media types bot should post (`"posting", "extensions"`), when to post them (`"posting", "time"`) and also where to find them (`"locations"`). You can also move them when sent by setting `"posting", "move_sent"` to `true`. 6. Good to go, run it! - `python ./main.py` + `python ./main.py` + Or you can also use `.\start.bat` on Windows and `bash ./start.sh` on Linux. + Additionally there are `loop.sh` and `loop.bat` available if you want your bot to start again after being stopped or after using `/reboot` command. ## Command line arguments Of course bot also has them. You can perform some actions with them. diff --git a/loop.bat b/loop.bat new file mode 100644 index 0000000..260cdf5 --- /dev/null +++ b/loop.bat @@ -0,0 +1,12 @@ +@echo off + +REM You can cd to your directory here, if you want +REM cd C:\Users\user\TelegramPoster + +:start +python main.py +echo To completely stop TelegramPoster now, please press Ctrl+C during the countdown! +echo Restarting in 5 seconds... +Timeout /t 5 +echo TelegramPoster has started! +goto start \ No newline at end of file diff --git a/loop.sh b/loop.sh new file mode 100644 index 0000000..44a2f41 --- /dev/null +++ b/loop.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +# You can cd to your directory here, if you want +# cd /home/user/TelegramPoster + +while true +do + python main.py + echo "To completely stop TelegramPoster now, please press Ctrl+C during the countdown!" + echo "Restarting in:" + for i in 5 4 3 2 1 + do + echo "$i..." + sleep 1 + done + echo "TelegramPoster has started!" +done \ No newline at end of file diff --git a/start.bat b/start.bat new file mode 100644 index 0000000..e9a42b4 --- /dev/null +++ b/start.bat @@ -0,0 +1,6 @@ +@echo off + +REM You can cd to your directory here, if you want +REM cd C:\Users\user\TelegramPoster + +python main.py \ No newline at end of file diff --git a/start.sh b/start.sh new file mode 100644 index 0000000..a3494da --- /dev/null +++ b/start.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +# You can cd to your directory here, if you want +# cd /home/user/TelegramPoster + +python main.py \ No newline at end of file