Skip to content

Guides · Discord bots

Upload a Python bot (discord.py)

Upload main.py and .env → start.

1. Prepare

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

  1. Service page → Open panel → Files → Upload (or create .env using New File).
  2. Console → Start.
  3. Console: 코드에서 쓰는 패키지를 설치합니다: discord.py python-dotenv (installing packages) → 봇을 시작합니다: main.py (starting bot) → Logged in: ….
  4. Run /ping in 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 .py file.
  • Packages: missing imports are installed (discord → discord.py, dotenv → python-dotenv). A changed requirements.txt is installed each time.
  • Set manually: panel Startup → Start file · Additional packages.
  • Do not upload venv or __pycache__.

5. Read messages (prefix commands)

  1. Developer Portal → your app → Bot → enable Message Content Intent.
  2. 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 pull on each start.
  • Create .env separately in panel Files; keep it out of the repository.

All guides Discord bot plans Contact support

Partner 봇 제작 외주 이어드림 커스텀 봇 · 컴포넌트 V2 · 웹 · 프로그램 · 로고 · 배너 · UI/UX Ask on Discord