A Discord bot is an ordinary program that keeps a connection open to Discord. Hosting it means putting that program somewhere it can run when your laptop is shut. The steps below are the whole job.
What to do
- Upload your project, not your whole folder
Your code, your
package.jsonorrequirements.txt, and any data files. Leave outnode_modules,venv,__pycache__and.git— they are big, slow to transfer, and rebuilt on the server anyway. - Set the startup file
The panel needs to know which file to run —
index.js,bot.py,main.js, whatever yours is called. If it is wrong, the console says the file cannot be found and nothing else happens. - Put the token in a variable, not in the code
Use an environment variable or a
.envfile that never leaves the server. There is a separate article on this and it is the one mistake that costs people their bot. - Start it and watch the console
The first start installs dependencies, which takes longer than every later start. Read the whole output — the useful line is usually near the top of the failure, not the bottom.
- Confirm in Discord, not in the console
«Logged in as…» in the console means the process is alive. The bot showing green in your member list means Discord agrees. Check the second one.
node_modules causes more problems than it solvesPackages with compiled parts are built for the machine that installed them. Copying them from Windows to a Linux host produces errors that look like your code is broken when it is not. Upload the manifest and let the server install.
If the bot does not run on your own machine, hosting it will not fix that. Get it working locally, then upload the exact same code — that way any new error is about the environment, and you know it.
The bot appears online in your server's member list and responds to a command you send it.