Game Servers

How can we help?

Guides and technical documentation for your Server4You dedicated server or VPS.

Pterodactyl Logo

Host a Discord Bot with Pterodactyl

This guide shows how to run your own Discord bot 24/7 on Pterodactyl — from importing a bot Egg to uploading your code and setting the bot token. You host the bot's program code, not a Discord server itself.

Prerequisites: Before you begin, make sure you have the following ready:

✓ A fully configured Pterodactyl panel — Initial Panel Configuration
✓ A bot application created in the Discord Developer Portal
✓ Your unique Bot Token, copied from the Discord Developer Portal

Step 1: Get a Language Egg

The Egg you need depends on the programming language your bot is written in. The Egg library provides generic Eggs for Node.js, Python and other languages in its Languages category.

2.Choose the Egg matching your bot's language — e.g. node.js generic for a JavaScript or TypeScript bot or python generic for a Python bot
3.Download the .json file via Download egg

Step 2: Import the Egg

Upload the downloaded Egg to your Pterodactyl panel:

1.Navigate to the Admin Area via the gear icon ⚙
2.Click Nests in the sidebar
3.Click Import Egg, select the .json file and choose a Nest under Associated Nest — e.g. a new Nest called Bots that you created beforehand via Create New. Then open the imported Egg and, on the Configuration tab, change the Start Configuration to a text your bot prints once it is running — otherwise the panel keeps showing the server as starting

Step 3: Create the Bot Server

Create a server instance for your bot to run on. Most bots are very lightweight and don't require much CPU or RAM.

1.Go to Servers → Create New
2.Give the server a name (e.g. My Discord Bot)
3.Under Nest Configuration, select the Nest and the Egg you just imported. Under Service Variables, set User Uploaded Files to 1 if you upload your files yourself instead of cloning a Git repository
4.Set appropriate resource limits and click Create Server

Step 4: Upload Your Bot's Files

Your bot's code needs to be uploaded to the server before it can run:

1.Navigate to your new bot server in the panel
2.Go to the Files tab
3.Upload all of your bot's files — e.g. index.js, app.py, package.json, requirements.txt or any other project files. The start file must match the Main file (Node.js) or App py file (Python) variable on the Startup tab

Step 5: Configure the Bot Token

The bot needs its token to authenticate with Discord's services:

1.The generic Eggs do not provide a token variable — store the token in a configuration file instead, e.g. a .env file that you create in the Files tab
2.Paste your Bot Token from the Discord Developer Portal into this file, e.g. as DISCORD_TOKEN=your-token
3.Make sure your bot's code reads the token from this file. If you use an Egg that does provide a token variable, enter the token on the Startup tab instead

Step 6: Start Your Bot

With everything configured, you can now start your bot:

1.Go to the Console tab
2.Click Start
3.Watch the console output for errors — the generic Eggs automatically install dependencies from package.json or requirements.txt before starting the bot

Further Documentation

For help building your bot, refer to the official Discord developer documentation.