Skip to main content

Discord Python Bot

How to Configure

In this guide, we're going to show you how to configure a Discord bot running Python code.

Out of the box, your server will not start - That's because we need to provide it with some python code that will run your bot!

There are a couple of ways to get your code onto the server. We'll go over those options below.

Option 1 - Startup Parameters & Git Repository

  1. Go to your server on the Straya Panel

  2. Go to Configuration -> Startup Parameters

  1. Provide a git repository address that contains python code. You can use your own, or use our repository that provides some basic code to get you started - https://github.com/Straya-Hosting/DiscordPythonBot

  1. Specify the git branch By default, this is usually either main or master. Check your git repository to be sure. In the case of our sample code, it's on the main branch

  1. Specify the bot python file This is the main code that starts your bot. Typically it's called bot.py - but it might be called something else in your case. Update as necessary. In our case with our sample code, it's called bot.py so that's what we'll use.

  1. Finally, update any of the other parameters if you need to or proceed to restart your server. After your server has restarted, check your file manager to see if the code from the git repository was pulled into your server. If not, or if you run into any issues, proceed to either option 2 or option 3.

Option 2 - Manually Clone a Git Repository

  1. Go to the file manager
  2. Click the three dots in the top right and click git Clone

  1. Enter the repository URL (Make sure it ends with .git) and the branch name

Option 3 - Manually Create the python files

  1. Go to the file manager

  2. Select the option to upload a file

  1. Upload all the files you need, then make sure to go into the Startup Parameters section in the menu and set the python bot file that your server can use to start the bot.