Host a Discord bot
Node.js, Python or Java. Upload your code, token as a variable, logs instead of input.
3 min read
On this page
Order
- On Discord bots, pick a plan and click Add to cart.
- In the cart, enter the Bot name and choose the runtime under Environment, for example Node.js, Python or Java. This determines the image and the startup command.
- Click Place order with obligation to pay. The first term is paid from your credit.
- Once the bot is set up, enter the start file and the bot token under Settings, Startup variables, then upload your code.
Dependencies
During setup we install the dependencies from the file that belongs to your runtime: package.json for Node.js (with npm), requirements.txt for Python (with pip). For Java you upload a finished jar and name it in the variable for the jar file.
This runs in a separate throwaway container on your directory, not on the host. If you change dependencies later, reinstall the bot once: under Settings, Reinstall. Your code stays where it is.
Update your code
Replace the files under Files or via SFTP, then restart.
Logs instead of input
For a bot, the console is a one-way street: you see the output live but cannot type into it. That is not a missing feature; it honestly reflects that a bot's output is not a command prompt. Startup errors appear there first.
After a crash
The Restart after a crash switch under Settings, General brings the bot back up by itself when the process ends unexpectedly, at most five times per hour. A stop you asked for does not trigger it.
What a bot does not have
No players, no plugins, no modpacks. A bot usually needs no port; you only need an extra port in the Network tab if your bot starts a web server, for example, and only if your plan includes them. MySQL databases are available as far as your plan includes database slots; otherwise use SQLite in the directory or an external service.
If the bot does not run, check the console first and then send a ticket.