To host a Pycord bot 24/7, run it on a machine that stays on instead of your PC: a Linux VPS with a systemd service if you host it yourself, or a bot plan on PlayNHost Discord bot hosting (from US$1.99 a month), where you upload your code, paste the token and press Start. In our test a Pycord 2.8.1 bot used about 51 MB of memory and reached Discord about 1.1 seconds after it was launched. Pycord installs as py-cord but you import it as discord, the same name as discord.py, so list only one of the two. The steps on PlayNHost:
- On the Discord bot hosting page, click Create Server on a plan. In the order window, answer What is your bot for? with Discord and pick Python.
- Open your server in the panel. The Set up your bot card on Overview opens at Connect to Discord. Its first step, What runs, should say This bot runs Python Bot.; click that step to check it, then Continue.
- At Connect to Discord, paste your token into Paste your bot token, click Connect, then Yes, continue.
- At Permissions, tick My code uses this only for the privileged intents your code asks for (the bot below needs none), click Add to a Discord server, then Continue.
- At Your code, click Upload files and upload
bot.pyand arequirements.txtthat listspy-cord, or click Connect Git. - If your main file is not
bot.py, set the Entry file on the Bot page, pane Code, and click Save. - Click Start bot and watch Console. When your bot prints
Logged in as ..., the card says Your bot is online in Discord.
The general Python steps (runtime, packages, console lines) are in How to host a Python Discord bot. This page covers what is different with Pycord.
What we measured
We ran each Python Discord library on our own servers, in the same Python 3.12 setup a bot plan uses, with a 1 GB memory limit:
| Library | Version | Memory at rest | Start to Discord's answer |
|---|---|---|---|
| Pycord | 2.8.1 | 51 MB | 1.1 s |
| discord.py | 2.7.1 | 48 MB | 1.0 s |
| nextcord | 3.2.0 | 47 MB | 1.0 s |
| disnake | 2.12.2 | 47 MB | 0.9 s |
| hikari | 2.7.0 | 61 MB | 1.3 s |
| Python alone | 3.12 | 9 MB |
How: the smallest program that loads the library and logs in with a fake token, installed the way our servers install it. Memory is what the process held 15 seconds after Discord refused the token, and start time runs from launch to that answer, so it includes one trip to Discord. Each figure is the median of three runs after a warm-up run. It is the floor: a bot that has connected, joined servers and cached members uses more, by an amount that depends on the bot.
What it means for the plan: a minimal Pycord bot takes about a tenth of the 0.5 GB STARTER plan. Size the plan for what your own bot keeps in memory, not for the library.
A minimal Pycord bot
It answers /ping with a slash command and prints a ready line. It reads the token from DISCORD_TOKEN, the name the panel gives your code.
requirements.txt
py-cord>=2.8,<3
bot.py
import os
import discord
bot = discord.Bot()
@bot.event
async def on_ready():
print(f"Logged in as {bot.user}")
@bot.slash_command(name="ping", description="Check that the bot answers")
async def ping(ctx: discord.ApplicationContext):
await ctx.respond("Pong!")
bot.run(os.environ["DISCORD_TOKEN"])
discord.Bot is Pycord's own class for slash commands. It registers /ping with Discord by itself each time it connects, because auto_sync_commands is on by default, so there is no sync step to write. The Logged in as line is what turns the chip on Overview to Online in Discord.
If the token is wrong
When Discord refuses the token, Pycord raises this error (the text our test bot printed):
LoginFailure: Improper token has been passed.
With bot.run() it ends a traceback as discord.errors.LoginFailure: Improper token has been passed. and the bot stops. The panel reads that line: the chip shows Token problem and a banner says Discord did not accept your bot token. Get a new token in the Discord Developer Portal: your application, Bot, Reset Token (it is shown once). Click Replace the token in the banner, then Replace token on the Discord pane, paste it and start the bot again. See How to create a Discord bot and get its token.
What a host needs to know about Pycord
- Install name and import name differ. You install
py-cordand writeimport discord. discord.py installs a module with the same name,discord, so the two cannot live side by side. Pycord's own guide says to uninstall discord.py first, and warns that uninstalling discord.py after installing py-cord can cause issues. - Moving a server from discord.py to Pycord. Our servers install packages into a
.localfolder and never remove one you take out ofrequirements.txt, so discord.py would stay next to Pycord. In Files, delete the.localfolder and the file.pnh/packages.state, then press Start: everything inrequirements.txtinstalls again, without discord.py. - Python version. Pycord 2.8.1 supports Python 3.10 to 3.14. The Runtime on the Code pane offers exactly these, with 3.12 as the default, so any choice works.
- Intents.
discord.Bot()uses the default intents, which include no privileged one, and slash commands need none. Prefix commands such as!pingneedintents.message_content = Truein your code and Message Content Intent switched on in the Developer Portal. If your code asks for it while it is off in the Portal, Discord refuses the login. See Fix "Used disallowed intents" on your Discord bot. - Keep on_connect free. The automatic registration runs in the bot's own
on_connect. If you defineon_connectyourself, Pycord's documentation says to callawait bot.sync_commands()in it, or your commands stop updating. Put start-up code inon_ready, as above. - Logging is off unless you turn it on. Pycord's
run()does not set up logging, so Python shows only the library's warnings and errors, not its info lines such as the login. Print your own ready line, as above, or calllogging.basicConfig(level=logging.INFO)to see what the library is doing. - Voice. For voice channels, write
py-cord[voice]inrequirements.txtinstead ofpy-cord.
Host it yourself on a Linux VPS
On Debian or Ubuntu, install Python, create a user and a folder for the bot, and install Pycord in a virtual environment:
sudo apt update
sudo apt install -y python3 python3-venv
sudo useradd --system --create-home --home-dir /opt/pycord-bot bot
sudo cp bot.py requirements.txt /opt/pycord-bot/
sudo chown bot: /opt/pycord-bot/bot.py /opt/pycord-bot/requirements.txt
sudo -u bot python3 -m venv /opt/pycord-bot/venv
sudo -u bot /opt/pycord-bot/venv/bin/pip install -r /opt/pycord-bot/requirements.txt
Put the token in a file only root can read. Create /etc/pycord-bot.env with sudo nano /etc/pycord-bot.env, write one line, DISCORD_TOKEN= followed by your token, save it and run sudo chmod 600 /etc/pycord-bot.env.
Then create /etc/systemd/system/pycord-bot.service:
[Unit]
Description=Pycord Discord bot
Wants=network-online.target
After=network-online.target
[Service]
User=bot
WorkingDirectory=/opt/pycord-bot
EnvironmentFile=/etc/pycord-bot.env
Environment=PYTHONUNBUFFERED=1
ExecStart=/opt/pycord-bot/venv/bin/python bot.py
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.target
Start it now and at every boot, then follow its output:
sudo systemctl daemon-reload
sudo systemctl enable --now pycord-bot
sudo journalctl -u pycord-bot -f
PYTHONUNBUFFERED=1 makes print() reach the journal at once instead of when a buffer fills. To update the bot, copy the new files, run the pip install line again and sudo systemctl restart pycord-bot.
Self-hosting or a bot plan
| Your own VPS | A PlayNHost bot plan | |
|---|---|---|
| Python | The version your distribution ships; you install and update it | Pick 3.10 to 3.14 under Runtime |
| Packages | You run pip install after each change | Installed at a start after requirements.txt or the Python version changes, and at the first start a day after the last install |
| Restarts | Your systemd unit | Started again after a crash; left stopped with the reason if it crashes again within a minute |
| The token | A file you protect yourself | Stored encrypted, checked with Discord when you paste it, given to your code as DISCORD_TOKEN |
| Errors | You read the journal | The console banner names the cause, such as a wrong token or a missing intent |
| System updates, firewall, SSH | Yours to do | Not your job |
Questions people ask
Can I have Pycord and discord.py in the same bot?
No. Both install the module discord, so one overwrites the other. Keep only py-cord in requirements.txt. If the server ran discord.py before, delete .local and .pnh/packages.state in Files so the packages install again cleanly.
Why does /ping not show up in my server?
Check the bot was added with Add to a Discord server and that the console shows the Logged in as line: Pycord registers the command when it connects. While you test, pass debug_guilds=[your_server_id] to discord.Bot(): the commands are then created only in that server, and Discord's documentation says server commands update instantly.
Is Pycord the same as discord.py?
No. Pycord started as a fork of discord.py and keeps much of its API, such as discord.Client and discord.ext.commands, but its slash commands differ: @bot.slash_command and ctx.respond() in Pycord, app_commands and a sync call in discord.py. Code written for one does not always run on the other.
Does a Pycord bot fit the smallest plan?
Yes. At about 51 MB in our test, a minimal Pycord bot uses about a tenth of the 0.5 GB STARTER plan. Move up when your bot itself needs it: large servers whose members it caches, files or images it handles, or data it keeps in memory.
Ready to run yours? Pick a plan on Discord bot hosting and upload your Pycord bot.



