Hosting & Running Python Discord Bots
This guide explains how to set up, deploy, and run Python-based Discord bots (using discord.py, disnake, or nextcord) on your CordenX panel.
1. File Structure & Dependencies
Ensure your project contains these essential files before uploading:
- Main Entry File: Usually
main.py,bot.py, orapp.py. - requirements.txt: A file listing all required Python modules (e.g.,
discord.py,python-dotenv).
2. Setting Up requirements.txt
Create a file named requirements.txt in your project folder containing your dependencies:
text
discord.py>=2.3.0
python-dotenv
aiohttp
3. Uploading Files & Environment Configuration
- Log into your panel and select your Discord Bot server instance.
- Go to File Manager (or connect via SFTP).
- Upload your
.pyscripts andrequirements.txt. - Create a
.envfile to store your credentials: env DISCORD_TOKEN=your_bot_token_here
4. Configuring Startup Settings
- Navigate to the Startup tab in the sidebar.
- Configure the startup variables:
- Main Python File: Set to
main.py(or your entry filename). - Python Version: Select Python 3.10+ or Python 3.11 from the image selection.
- Switch to the Console tab and click Start. The panel will install packages from
requirements.txtautomatically.