Deploy a Python Discord Bot on Pterodactyl
Upload a Python Discord bot to a Pterodactyl host, set the start file, install requirements, add the token safely and start it.
To run a Python Discord bot on a Pterodactyl host, you upload your files, set the startup file, install the packages from requirements.txt, add your token as a variable and press Start. Names of fields differ a little between hosts, but the idea is the same.
What you need first
- Your bot code with a main file such as
main.py - A
requirements.txtlisting the packages the bot uses, for examplediscord.py - Your bot token from the Discord developer portal, kept private
- A Python bot server on a host such as our Discord bot hosting
Deploy your bot
- Open the Files tab of your server and upload main.py, requirements.txt and any other bot files.
- Open the Startup tab and set the Python file to main.py. Add your requirements file name if there is a field for it.
- Add your bot token as a startup variable or an environment value. Do not write it into your code.
- Go to the Console tab and press Start so the server installs the packages and launches the bot.
- Watch the console until you see your bot log in, then check that it shows online in Discord.
Read the token from the environment
In Python, read the token with os.environ["TOKEN"] instead of pasting it in the file. That way you can share your code without exposing the bot. If the token ever leaks, reset it in the developer portal straight away.
Fix common start-up errors
- ModuleNotFoundError: a package is missing. Add it to requirements.txt and restart so it installs.
- Improper token or login failure: the token is wrong or was reset. Paste the new one with no spaces.
- Privileged intent error: enable the intent in the developer portal and in your code.
- The file is not found: the startup file name does not match your upload. Check the exact name and capital letters.
Updating your bot
Stop the bot, upload the new files, start it again and watch the console. Keep a copy of the last working version so you can roll back. If the bot keeps stopping, read why a Discord bot goes offline, and see how much RAM it needs.
The Pterodactyl documentation explains the panel in detail. Our Discord bot services have a 1-day money-back guarantee from the initial order, so you can test the whole process safely. See the refund policy.
Frequently asked questions
How do I run a Python Discord bot on Pterodactyl?
Upload your files, set the startup file, install your requirements, add the token as a variable and press Start in the console.
Where should I put my bot token?
In a startup variable or environment value that your code reads, never directly in the code or a public repository.
Why does my bot say module not found?
A package is missing. Add it to requirements.txt and restart so the server installs it.
Which languages does BrackNodes bot hosting support?
Python, Node.js, Java and Go.
Can I try bot hosting before committing?
Discord bot services have a 1-day money-back guarantee from the initial order. See the refund policy for details.