To host a nextcord 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 nextcord 3.2.0 bot used about 47 MB of memory and reached Discord about 1.0 seconds after it was launched. The first thing to check: nextcord 3 needs Python 3.12 or newer. 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 listsnextcord, or click Connect Git. - On the Bot page, pane Code, keep Runtime at Python 3.12 (recommended), 3.13 or 3.14, set the Entry file if it is not
bot.py, 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 (packages, console lines) are in How to host a Python Discord bot. This page covers what is different with nextcord.
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 |
|---|---|---|---|
| nextcord | 3.2.0 | 47 MB | 1.0 s |
| discord.py | 2.7.1 | 48 MB | 1.0 s |
| Pycord | 2.8.1 | 51 MB | 1.1 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 nextcord bot uses a small part of the 0.5 GB STARTER plan. Size the plan for what your own bot keeps in memory, not for the library.
A minimal nextcord 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
nextcord>=3.2,<4
bot.py
import logging
import os
import nextcord
from nextcord.ext import commands
logging.basicConfig(level=logging.INFO)
bot = commands.Bot()
@bot.event
async def on_ready():
print(f"Logged in as {bot.user}")
@bot.slash_command(description="Check that the bot answers")
async def ping(interaction: nextcord.Interaction):
await interaction.send("Pong!")
bot.run(os.environ["DISCORD_TOKEN"])
The version range in requirements.txt is on purpose: on a Python that is too old, pip then stops with an error instead of quietly installing an old nextcord (see below). commands.Bot() needs no prefix for slash commands. nextcord registers /ping with Discord by itself each time it connects. 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, nextcord raises this error (the text our test bot printed):
LoginFailure: Improper token has been passed.
With bot.run() it ends a traceback as nextcord.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 nextcord
- Python 3.12 or newer. Every nextcord 3 release requires Python 3.12 or later. On Python 3.10 or 3.11, a plain
nextcordline makes pip install 2.6.0, from September 2023, the last release that supports them, and code written for nextcord 3 may then fail. Withnextcord>=3.2,<4pip refuses instead: the console shows pip's error and[PlayNHost] pip could not install everything in requirements.txt., and if nextcord was never installed on the server, the bot then stops withModuleNotFoundError: No module named 'nextcord'. Choose 3.12, 3.13 or 3.14 under Runtime; the change applies at the next start. - The import is nextcord. You install
nextcordand writeimport nextcordandfrom nextcord.ext import commands. Coming from discord.py, nextcord's migration guide says to uninstall discord.py and changediscordtonextcordin your imports and code. - Commands it does not know are deleted. When it connects, nextcord registers new commands, updates changed ones and deletes commands on Discord that your code does not define (
rollout_delete_unknown, on by default). If a second program uses the same bot, such as a test copy on your PC, the commands only that program defines are removed each time the server's copy connects. Use a separate application for testing. - Keep on_connect free. That registration runs in the bot's own
on_connect. Defining@bot.event async def on_connect()replaces it and your commands stop updating. Put start-up code inon_ready, as above. - Turn logging on. nextcord does not set up logging itself, and its own documentation strongly recommends configuring it. Without it, Python shows only warnings and errors;
logging.basicConfig(level=logging.INFO)in the bot above also shows the library's info lines. - Intents. The default intents include no privileged one, and slash commands need none. Prefix commands need
intents.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.
Host it yourself on a Linux VPS
Check the Python version first: python3 --version must say 3.12 or newer. Ubuntu 24.04 ships 3.12 and Debian 13 ships 3.13; Debian 12 ships 3.11 and Ubuntu 22.04 ships 3.10, both too old for nextcord 3. Then install Python, create a user and a folder for the bot, and install nextcord in a virtual environment:
sudo apt update
sudo apt install -y python3 python3-venv
sudo useradd --system --create-home --home-dir /opt/nextcord-bot bot
sudo cp bot.py requirements.txt /opt/nextcord-bot/
sudo chown bot: /opt/nextcord-bot/bot.py /opt/nextcord-bot/requirements.txt
sudo -u bot python3 -m venv /opt/nextcord-bot/venv
sudo -u bot /opt/nextcord-bot/venv/bin/pip install -r /opt/nextcord-bot/requirements.txt
Put the token in a file only root can read. Create /etc/nextcord-bot.env with sudo nano /etc/nextcord-bot.env, write one line, DISCORD_TOKEN= followed by your token, save it and run sudo chmod 600 /etc/nextcord-bot.env.
Then create /etc/systemd/system/nextcord-bot.service:
[Unit]
Description=nextcord Discord bot
Wants=network-online.target
After=network-online.target
[Service]
User=bot
WorkingDirectory=/opt/nextcord-bot
EnvironmentFile=/etc/nextcord-bot.env
Environment=PYTHONUNBUFFERED=1
ExecStart=/opt/nextcord-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 nextcord-bot
sudo journalctl -u nextcord-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 nextcord-bot.
Self-hosting or a bot plan
| Your own VPS | A PlayNHost bot plan | |
|---|---|---|
| Python | The version your distribution ships, which must be 3.12 or newer for nextcord 3 | Pick 3.12, 3.13 or 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 package that did not install |
| System updates, firewall, SSH | Yours to do | Not your job |
Questions people ask
Why did pip install nextcord 2.6.0?
Your Python is 3.10 or 3.11. nextcord 3 needs 3.12 or newer, so pip picks the newest release that still supports your Python. Set Runtime on the Code pane to Python 3.12 or newer and start the bot again: the packages install again because the Python version changed.
My slash commands disappeared. Why?
A common cause: another program logged in with the same bot and synced its own list, and nextcord deletes the commands its code does not define. Run only one copy per application. While testing, guild_ids=[your_server_id] on a command, or default_guild_ids on commands.Bot(), creates it only in that server, and Discord's documentation says server commands update instantly.
Can I keep my discord.py code?
Most of it. nextcord started as a fork of discord.py, so classes such as Client, Intents and ext.commands are there under the nextcord name. Slash commands differ: @bot.slash_command and interaction.send() in nextcord, app_commands in discord.py. Uninstall discord.py and change the imports, as nextcord's migration guide says.
Does a nextcord bot fit the smallest plan?
Yes. At about 47 MB in our test, a minimal nextcord bot leaves most of the 0.5 GB STARTER plan for your own code. 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 nextcord bot.



