To host a disnake 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 disnake 2.12.2 bot used about 47 MB of memory and reached Discord about 0.9 seconds after it was launched. disnake asks you to pin its version, and on a server that updates packages by itself that matters. 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.txtwith a pinneddisnakeline, 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 disnake.
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 |
|---|---|---|---|
| disnake | 2.12.2 | 47 MB | 0.9 s |
| discord.py | 2.7.1 | 48 MB | 1.0 s |
| Pycord | 2.8.1 | 51 MB | 1.1 s |
| nextcord | 3.2.0 | 47 MB | 1.0 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 disnake 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 disnake 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
disnake==2.12.*
bot.py
import os
import disnake
from disnake.ext import commands
bot = commands.InteractionBot()
@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(inter: disnake.ApplicationCommandInteraction):
await inter.response.send_message("Pong!")
bot.run(os.environ["DISCORD_TOKEN"])
commands.InteractionBot is disnake's bot for application commands only, with no prefix to set. It registers /ping with Discord by itself after 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, disnake raises this error (the text our test bot printed):
LoginFailure: Improper token has been passed.
With bot.run() it ends a traceback as disnake.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 disnake
- Pin the version. disnake's README says it does not quite follow semantic versioning and recommends pinning a minor version, such as
disnake==2.12.*ordisnake~=2.12.2. On our servers this counts twice: the start script runspip install -Uon yourrequirements.txtwhen it changes, and again at the first start a day after the last install, so an unpinneddisnakeline can move to a new release on its own. With the pin you get fixes within 2.12 and choose when to move up. - The import is disnake. You install
disnakeand writeimport disnake; it does not install adiscordmodule, so it does not overwrite discord.py or Pycord. Keep only the library your code uses inrequirements.txtall the same. - Python version. disnake 2.12 needs Python 3.10 or newer. The Runtime on the Code pane offers 3.10 to 3.14, with 3.12 as the default, so any choice works.
- Command sync deletes what your code does not define. By default disnake syncs global and server commands and may delete commands on Discord that your code no longer has (
allow_command_deletion). A second program logged in with the same bot, such as a test copy on your PC, loses its commands when the server's copy syncs. Use a separate application for testing. - Seeing the sync. Pass
command_sync_flags=commands.CommandSyncFlags(sync_commands_debug=True)toInteractionBot(). disnake then prints what it syncs even when logging is not set up, so the lines show in Console. - Intents. The default intents include no privileged one, and slash commands need none. Prefix commands with
commands.Botneedintents.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
On Debian or Ubuntu, install Python, create a user and a folder for the bot, and install disnake in a virtual environment:
sudo apt update
sudo apt install -y python3 python3-venv
sudo useradd --system --create-home --home-dir /opt/disnake-bot bot
sudo cp bot.py requirements.txt /opt/disnake-bot/
sudo chown bot: /opt/disnake-bot/bot.py /opt/disnake-bot/requirements.txt
sudo -u bot python3 -m venv /opt/disnake-bot/venv
sudo -u bot /opt/disnake-bot/venv/bin/pip install -r /opt/disnake-bot/requirements.txt
Put the token in a file only root can read. Create /etc/disnake-bot.env with sudo nano /etc/disnake-bot.env, write one line, DISCORD_TOKEN= followed by your token, save it and run sudo chmod 600 /etc/disnake-bot.env.
Then create /etc/systemd/system/disnake-bot.service:
[Unit]
Description=disnake Discord bot
Wants=network-online.target
After=network-online.target
[Service]
User=bot
WorkingDirectory=/opt/disnake-bot
EnvironmentFile=/etc/disnake-bot.env
Environment=PYTHONUNBUFFERED=1
ExecStart=/opt/disnake-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 disnake-bot
sudo journalctl -u disnake-bot -f
PYTHONUNBUFFERED=1 makes print() reach the journal at once instead of when a buffer fills. Here nothing updates by itself: to move to a newer disnake, change the pin, run the pip install line again and sudo systemctl restart disnake-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 with pip install -U at a start after requirements.txt or the Python version changes, and at the first start a day after the last install, within your pins |
| 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
My disnake bot broke after a restart without any change. Why?
If requirements.txt says only disnake, the package install at the first start a day after the last one may have moved it to a newer release, and disnake does not promise that minor releases are free of breaking changes. Pin the version you tested, for example disnake==2.12.*, and start the bot again: the packages install again because the file changed.
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 Logged in as. While you test, pass test_guilds=[your_server_id] to InteractionBot(), as disnake's own examples do: the commands are then created in that server, and Discord's documentation says server commands update instantly.
Is disnake code the same as discord.py code?
Close, not the same. disnake keeps the syntax and structure of discord.py 2.0, under the disnake name, but has its own slash commands: @bot.slash_command with inter.response.send_message(), and options read from the function's parameters. Change the imports and the command code when you move.
Does a disnake bot fit the smallest plan?
Yes. At about 47 MB in our test, a minimal disnake 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 disnake bot.



