Intermediate6 minUpdated: 2026-09-13
Developing Async Python Discord Bots with discord.py and 24/7 Hosting
Build modern slash command bots using discord.py 2.0+, virtual environments, and continuous daemon supervision.
Verified against
- discord.py
- 2.x
- Python
- 3.11 / 3.12
- Last checked
- 2026-09-13
Before you start
- A Discord bot token
- A service running Python
- Message Content Intent enabled in the Developer Portal
On This Page
All Guides
Reading progress
Modern Python Discord bot development leverages `discord.py` 2.0+ with asyncio concurrency. Using a clean virtual environment (`venv`) prevents library collisions across server workloads.
1. Modern Slash Command Template#
bot.py
import os
import discord
from discord import app_commands
from discord.ext import commands
intents = discord.Intents.default()
bot = commands.Bot(command_prefix="!", intents=intents)
@bot.event
async def on_ready():
await bot.tree.sync()
print(f"Bot aktif: {bot.user}")
@bot.tree.command(name="ping", description="Gecikme süresini ölçer")
async def ping(interaction: discord.Interaction):
latency = round(bot.latency * 1000)
await interaction.response.send_message(f"Pong! Gecikme: {latency}ms")
bot.run(os.getenv("DISCORD_TOKEN"))Method Comparison
How to Implement This?
Clodo Control Panel Quick Method
Runtime selection in the panelThe Python runtime is selected in the panel; you do not install an OS or manage pip by hand.
Where in Panel? Panel > Service detail > 'Runtime' tab, then pick the Python version.
Step-by-step Execution:
- 1Pick the Python version on the 'Runtime' tab.
- 2Upload bot.py and requirements.txt from the 'SFTP & Files' tab.
- 3Dependencies are installed from requirements.txt on boot, so keep that file current.
- 4Start the service and follow the logs in the panel console.
Was this guide helpful?
Feedback goes straight to the team that maintains this guide.
Related Guides
Developing 7/24 Discord.js v14 Bots and Managing with PM2
Step-by-step guide to building a Discord.js v14 bot, slash commands, and hosting it 24/7 using PM2 process manager.
Continuous Deployment: Auto-Deploying to VPS via GitHub Webhooks
Trigger automatic git pulls, builds, and graceful process restarts upon every repository push.

