1. Home
  2. Guides
  3. Discord bots
Discord botsGuide

How to host a Discord bot written in Python

If your discord.py bot only works while your computer is on, hosting it on a server keeps it connected around the clock. These are the steps.

  • 2 min read
  • 6 sections
Discord bots

In short

  • The bot runs on Python 3.12; the panel looks for main.py or bot.py, or the file you set.
  • Upload your .py files and your dependencies over FTP.
  • Paste the token in the panel, press Start and read the logs if the bot does not answer.

1. Check that it starts on your computer

Before uploading, run it locally and confirm it connects to Discord and answers commands. An error that already fails on your machine will fail on the server too.

2. Be clear about the main file

The panel looks for main.py or bot.py to start the bot. If your main file is named differently, set it in the panel settings.

3. Use the right Python version

Python 3.12 is the default. If your project uses a different version, select it in the panel settings and check that your dependencies support it.

4. Upload the files over FTP

Upload your .py files over FTP using the credentials from the panel. List dependencies such as discord.py in a requirements.txt file beside the main file or in the project root. The panel installs them at startup.

5. Put the token in the panel and start

Do not write the token into the code or push it to a public repository: whoever has it controls your bot. Save it in the panel. In your code, import os and read the token with os.environ['DISCORD_BOT_TOKEN']. Then press Start.

6. Read the logs

If the bot does not answer, the first place to look is the logs in the panel: that is where a startup error, a missing dependency or a wrong token shows up.