Guides · Discord bots
Upload a Python bot (discord.py)
Upload main.py and .env → start.
1. Prepare
- Bot token: step 1 of Keep a Discord bot online.
- Choose Python 3.11 · 3.12 · 3.13 when ordering.
2. Two files
main.py
import os
import discord
from discord import app_commands
from dotenv import load_dotenv
load_dotenv()
client = discord.Client(intents=discord.Intents.default())
tree = app_commands.CommandTree(client)
@tree.command(name="ping", description="Response time")
async def ping(interaction: discord.Interaction):
await interaction.response.send_message(f"pong {round(client.latency * 1000)}ms")
@client.event
async def on_ready():
await tree.sync()
print(f"Logged in: {client.user}")
client.run(os.getenv("TOKEN"))
.env (keep the token out of code)
TOKEN=your_copied_token
3. Upload · start
- Service page → Open panel → Files → Upload (or create
.envusing New File). - Console → Start.
- Console:
코드에서 쓰는 패키지를 설치합니다: discord.py python-dotenv(installing packages) →봇을 시작합니다: main.py(starting bot) →Logged in: …. - Run
/pingin Discord. Commands may take a few minutes to appear at first.
4. Automatic setup
- Entry file:
main.py→bot.py→app.py→index.py·run.py·start.py→ the only.pyfile. - Packages: missing imports are installed (
discord→ discord.py,dotenv→ python-dotenv). A changedrequirements.txtis installed each time. - Set manually: panel Startup → Start file · Additional packages.
- Do not upload
venvor__pycache__.
5. Read messages (prefix commands)
- Developer Portal → your app → Bot → enable Message Content Intent.
- Code:
intents = discord.Intents.default()→intents.message_content = True.
6. GitHub (optional)
- Panel Startup → Git address · Git branch (private repos: Git username · Git token).
- With an empty server directory, Settings → Reinstall Server to clone the repository.
- Auto update
1→git pullon each start. - Create
.envseparately in panel Files; keep it out of the repository.
All guides Discord bot plans Contact support
Partner 봇 제작 외주 이어드림 커스텀 봇 · 컴포넌트 V2 · 웹 · 프로그램 · 로고 · 배너 · UI/UX Ask on Discord