Fix line endings...

This commit is contained in:
Jakub Kuczys
2023-04-20 01:10:09 +02:00
parent ce2093d0d1
commit 6f4063e4a8

View File

@@ -1,48 +1,48 @@
.. _autostart_windows: .. _autostart_windows:
============================================== ==============================================
Setting up auto-restart using batch on Windows Setting up auto-restart using batch on Windows
============================================== ==============================================
.. note:: This guide assumes that you already have a working Red instance. .. note:: This guide assumes that you already have a working Red instance.
----------------------- -----------------------
Creating the batch file Creating the batch file
----------------------- -----------------------
Create a new text document anywhere you want to. This file will be used to launch the bot, so you may want to put it somewhere convenient, like Documents or Desktop. Create a new text document anywhere you want to. This file will be used to launch the bot, so you may want to put it somewhere convenient, like Documents or Desktop.
Open that document in Notepad, and paste the following text in it: Open that document in Notepad, and paste the following text in it:
.. code-block:: batch .. code-block:: batch
@ECHO OFF @ECHO OFF
:RED :RED
CALL "%userprofile%\redenv\Scripts\activate.bat" CALL "%userprofile%\redenv\Scripts\activate.bat"
python -O -m redbot <your instance name> python -O -m redbot <your instance name>
IF %ERRORLEVEL% NEQ 0 ( IF %ERRORLEVEL% NEQ 0 (
ECHO Restarting Red... ECHO Restarting Red...
GOTO RED GOTO RED
) )
Replace ``<your instance name>`` with the instance name of your bot. Replace ``<your instance name>`` with the instance name of your bot.
If you created your VENV at a location other than the recommended one, replace ``%userprofile%\redenv\Scripts\activate.bat`` with the path to your VENV. If you created your VENV at a location other than the recommended one, replace ``%userprofile%\redenv\Scripts\activate.bat`` with the path to your VENV.
Click "File", "Save as". Change the dropdown "Save as type" to "All Files (*.*)". Set the filename to ``start_redbot.bat``, and click save. Click "File", "Save as". Change the dropdown "Save as type" to "All Files (*.*)". Set the filename to ``start_redbot.bat``, and click save.
There should now be a new file in the location you created the text document in. You can delete that text document as it is no longer needed. There should now be a new file in the location you created the text document in. You can delete that text document as it is no longer needed.
You can now use the ``start_redbot.bat`` batch file to launch Red by double clicking it. You can now use the ``start_redbot.bat`` batch file to launch Red by double clicking it.
This script will automatically restart red when the ``[p]restart`` command is used or when the bot shuts down abnormally. This script will automatically restart red when the ``[p]restart`` command is used or when the bot shuts down abnormally.
------------------------- -------------------------
Launch the bot on startup Launch the bot on startup
------------------------- -------------------------
Create a shortcut of your ``start_redbot.bat`` file. Create a shortcut of your ``start_redbot.bat`` file.
Open the "Run" dialogue box using Windows Key + R. Open the "Run" dialogue box using Windows Key + R.
Enter ``shell:startup`` if you want the bot to launch only when the current user logs in, or ``shell:common startup`` if you want the bot to launch when any user logs in. Enter ``shell:startup`` if you want the bot to launch only when the current user logs in, or ``shell:common startup`` if you want the bot to launch when any user logs in.
Drag the shortcut into the folder that is opened. The bot will now launch on startup. Drag the shortcut into the folder that is opened. The bot will now launch on startup.