blog/how-to-host-a-discord-bot
How to host a Discord bot yourself
A Discord bot is only online while its program is running. When the program stops, the bot goes offline and its buttons stop working. Hosting a bot means keeping that program running in a place that stays on and can reach the internet.
You do not need to know how to code. The exact clicks are on our Help page.
A bot is a program that has to stay running
Discord only shows the bot. The actual program runs somewhere else — on your computer, on a small rented server, or on a bot host — and talks to Discord over the internet.
For the bots we build, that program is written in Python and starts from bot.py. While it is running, it can welcome new members, open tickets, hand out roles, run giveaways and moderate chat. If the program stops, all of that pauses until you start it again. We deliver the bot as a zip with setup steps, and you run it.
Three places you can run it
There is no single "correct" host. Pick the option that matches how often the bot needs to be online. Our Help page has a section called Keep it online 24/7 with the same three options.
- Your own computer (free). Install Python, fill in your settings, and start the bot on Windows, Mac, or Linux. If the zip includes a start script (
start-bot.batorstart-bot.command), you can double-click it; it restarts the bot if the program stops. This is a good way to test. The bot goes offline when the computer sleeps, restarts, or shuts down, so turn off sleep if you want it on overnight at home. - A small rented server (a VPS). This is a small Linux computer you rent, usually for a few dollars a month. Copy the bot folder onto it, install Python 3.10 or newer, and start the bot there so it stays online when your computer is off. A tool like
tmuxcan keep it running after you disconnect, but it will not restart the bot after a reboot; ask your host about a systemd service, or use a bot host. The Help page walks through a typical Ubuntu setup. - A bot host or game-panel host. Upload the whole bot folder (including
.envandstate.jsonif you have one), set the start file tobot.py, and click Start. Run any one-time server builder (for Server Workshop bots,setup_server.py) on your own computer first, then upload the folder with thestate.jsonfile it created.
Keep the bot's folder together. state.json and the data/ folder hold your server's IDs, levels and other saved data, so keep a backup on a different drive.
The safe setup path
The full click-by-click path is on the Help page. The README inside your zip is written for your exact bot; if the two ever disagree, follow the README. In outline:
- Create the bot in the Discord Developer Portal and open the Bot page.
- Under Privileged Gateway Intents, switch on Server Members Intent and Message Content Intent, then save. Leave Presence Intent off unless your README says otherwise.
- Reset and copy your bot token — the bot's password — and keep it private. You will put it in a settings file, not in Discord.
- Invite the bot with a link that includes the
botandapplications.commandsscopes and only the permissions it needs. You do not need Administrator. - Turn on Developer Mode in Discord and copy your server ID (
GUILD_ID). - Install Python 3.10 or newer. On Windows, tick "Add python.exe to PATH" in the installer.
- Unzip the bot, copy
.env.exampleto a file named exactly.env(not.env.txt), and paste in your token and server ID. - Install the add-ons from
requirements.txtand startbot.py, as Help describes. If your package can build channels and roles, run that setup step first.
The first time through takes about 30 minutes. After that, starting the bot is usually one command or a double-click.
Never share your bot token or .env file
The token is the bot's password. Anyone who has it can control the bot, and often the server with it. The .env file is where that token lives, along with your server IDs.
Do not post the token in chat, send it in a message, put it in a screenshot, or upload it anywhere. Do not send your .env file to anyone who offers to "fix" the bot, including us. If we need to help, we will ask for the error line from the bot's window, never for the token.
If the token ever leaks, reset it right away: Developer Portal → Bot → Reset Token, put the new token in your .env file, and start the bot again. The old token stops working at once.
Keeping the bot online
Once Discord shows the bot as online, keep the program running. Leave it open on your computer, or use the start script. On a VPS, make sure it survives you logging out and a reboot. On a bot host, check that it restarts if it crashes.
If buttons say "This interaction failed," or the bot shows as offline, the program is not running. Start it again and check the bot's window for an error. Help covers common ones, including a mistyped token, a .env.txt filename on Windows, and a missing server ID.
You get a zip, and you run it
Server Workshop bots are delivered as a zip, with setup steps in the README and on the Help page. You pick a package on Pricing, we build it (Basic takes 3 days, Standard 4 and Premium 2), and you host it yourself.
Packages start at $25 for Basic, $50 for Standard (tickets, moderation, levels and more, with channels and roles built for you), and $75 for Premium, which adds a private staff server. A $5/month Bot Care Plan on this site covers a monthly checkup, updates when Discord changes something, small bug fixes and one small change a month. You still host the bot, and you can cancel anytime by asking in our Discord. Never send us your token or .env file.
To see a finished bot, join our Discord at discord.gg/mQGurnyCDs or look at Features. When you are ready, pick a package on Pricing.
Frequently asked questions
Do I have to host the bot myself?
Yes. You run the bot yourself, and every order comes with setup steps. See the Help page.
Does my computer have to stay on?
Only while you want the bot online. You can leave your computer on, or run the bot on a small rented server or a bot host.
Do I need to know how to code?
No. You install Python, copy a settings file and start one program. The Help page shows each step for Windows, Mac and Linux.
What should I do if my bot token leaks?
Reset it in the Discord Developer Portal (Bot → Reset Token), put the new token in your .env file, and start the bot again. The old token stops working at once.
What is in the zip I get?
Your bot, a README, a blank .env.example settings file, and the steps to run it. Standard and Premium zips can also include a server builder. See How it works and Help.
Keep reading.
Ready for a bot that fits your server?
Pick a package, or join our Discord and ask us anything first.