How to setup your Python based Discord Bot
Preparation
To get started with your Python based bot, you'll want to ensure you have all of the files that you need for your bot ready first. Primarily, you will need the following:
requirements.txt
- This file tells our panel about any requirements/dependencies your bot requires. As long as this file contains the list of packages that your bot uses, our panel will automatically install said packages when your bot is next started. Alternatively, you can install any needed packages manually via the Python Package Manager
link on the left sidebar of your panel.
bot.py
- Your bot's main starting point. While the name of this file is not important, we will use bot.py
as the example for this guide. This file can be named whatever you would like, just remember to mentally replace bot.py
with whichever file name you go with while reading this guide.
Both of these files should be saved somewhere on your computer, along with any other files that your bot requires to run.
Uploading your bot's files
For the next step, we'll go ahead and get our bot's files uploaded to our bot hosting service.
First head over to the File Manager
link on your panel's left sidebar, like so:
Generally there will be some files here that are pre-installed on a Python bot hosting plan. These files will not cause any harm (uploading a file with the same name will just simply overwrite it), however we'll go ahead and delete some of these files. In this case, delete bot.py
and requirements.txt
.
With those files being removed, we can now go ahead and upload our bot's files. There are multiple options you can utilize to accomplish this:
- Simply drag and drop your bot's files onto the File Manager window
- Or, click
Upload
->File
and choose your bot's files in the window that pops up - Alternatively, you can also deploy your bot's files via FTP, which is useful for deploying from say a build service. You can grab the FTP details for your bot hosting plan via the
FTP Client Details
link on the left sidebar of the File Manager.
Starting your bot
Now that our bot's files have been uploaded, ensure that your panel knows which file to launch. In this example, that file is bot.py
however feel free to change this to your bot's actual start file if the name differs.
- Click
Back
on the panel's left sidebar from the File Manager window to get back to the main page of your panel - Next to
Start File
, type in the file name of your bot's start file (bot.py
in this example) - Press
Save
at the bottom of the panel
With that being set, head over to the Console
link on the left sidebar of your panel, and now click the green Start
button!
Our example bot from this example does not do much other than print one line, however most bots will just simply run in the background. Feel free to leave the console page once you're all set.
If you run into any issues getting your bot started, please feel free to reach out to our support team so that we may provide assistance with this. You can reach our support team by either opening a ticket on our website or our Discord.
Updated on: 27/07/2021
Thank you!