Reputation: 101
This is something that I've actually had quite the struggle to do, as a beginner, and sadly google wasn't helpfull at all to me since everything I found was full of seemingly complex codes and all that
I'll just answer myself below to try explaining simply what I did to do that
Upvotes: 1
Views: 3326
Reputation: 130
In case you want a script for a linux environment:
# /bin/sh
while true; do
echo "Starting Bot ..."
# The command to start your bot here
echo "Bot crashed ... Restarting in 5 seconds..."
sleep 5
done
Upvotes: 0
Reputation: 101
Keep in mind I am a beginner so if anything here is wrong feel free to correct me, that being said it seems to work flawlessly when it comes to restarting my wonky bot whenever it crashes
So this is what I ended up doing :
Made a new .bat file that would run and restart my bot whenever it crashed
To do that simply create a new notepad file with the following code and save it as a .bat file
@echo off
echo Starting..
:main
YourBotName.py
echo OwO what's this, the bot crashed, restarting it ;3
goto main
Just replace "YourBotName" with the appropriate file name and it should work
Upvotes: 2