Contents
A Discord bot differs from a website in that it doesn’t wait for visitors. It’s a program that holds a permanent connection to Discord’s Gateway over a WebSocket and receives events the moment they happen: a new message, a member joining, a slash command. If that connection drops and isn’t reopened, the bot shows as offline in every server.
What a Discord bot needs to run
| Requirement | Details |
|---|---|
| Language | Node.js with discord.js, or Python with discord.py or a similar library. Use the language version your library requires |
| Token | From the Developer Portal, in an environment variable or a .env file that never goes to GitHub |
| Intents | Decide which events the bot receives. Message Content, Server Members and Presence are privileged and must be enabled in the portal |
| Slash commands | Registered once through the API with a separate script, not on every start |
| An always-on process | Stays connected and is restarted if it crashes |
| Storage | SQLite or MySQL/MariaDB for per-server settings and member points |
If your code requests a privileged intent you haven’t enabled in the portal, Discord refuses the connection with a disallowed intents error.
There’s a second route for commands only: an Interactions Endpoint URL, where Discord sends each command as an HTTPS request to your URL. Your code must verify the Ed25519 signature and respond within 3 seconds. This runs as a web app, but it doesn’t receive message or member events.
Free hosting and Discord bots
The same problem keeps coming up: free plans stop apps that receive no web traffic, and a Gateway bot receives none. That’s why the trick of adding a tiny web server to the bot and pinging it every few minutes from an outside service is so common. It’s fragile and breaks some platforms’ terms. ArabyHost is paid; the free alternative while you develop is running the bot on your own machine. See also the real free hosting options and their limits.
Which ArabyHost plan fits a bot
The AI and Developer plans: they run Node.js 20 and 24 and Python 3.9 to 3.12, give you SSH inside CageFS, and allow background workers kept alive by cron jobs. Outbound connections to Discord’s Gateway and API are allowed. For a new discord.js bot, pick Node.js 24. The shared plans don’t run Node or Python, so they can’t host Discord bots.
How the bot runs here
- In the Developer Portal, create the application and bot, copy the token, and enable only the privileged intents your code needs.
- Create an app in Setup Node.js App with version 24 for the bot folder and install packages, or connect over SSH and run
npm install. - Put
DISCORD_TOKENin a.envfile inside the bot folder. Node.js 24 reads it directly with the--env-fileflag. - Register slash commands once over SSH:
node --env-file=.env deploy-commands.js. - Keep the bot alive with a cron job every minute;
flockprevents a second copy:
* * * * * /usr/bin/flock -n /home/USER/discord.lock /opt/alt/alt-nodejs24/root/usr/bin/node --env-file=/home/USER/discord-bot/.env /home/USER/discord-bot/index.js >> /home/USER/discord-bot/bot.log 2>&1
A discord.py bot works the same way, using the Python path inside its virtual environment. The full walkthrough is in the Discord bot guide, and the cron generator helps with the schedule.
What’s included
- Free automatic SSL if you use an Interactions Endpoint or a web dashboard for the bot.
- Daily JetBackup backups of the database and server settings.
- Each account isolated with CageFS and its own resource limits.
- Claude Code and Codex over SSH, to write and debug commands on the server.
- The Araby AI assistant reads error logs and explains the fix, plus support in Arabic.
Limits to know
- Voice and music bots use CPU and bandwidth continuously and don’t suit per-account resource limits.
- Very large bots: Discord requires sharding once a bot reaches 2,500 servers, and at that size you usually need a dedicated server’s resources; we don’t offer VPS yet.
- No root, no Docker, no GPU: ready-made Docker setups won’t run, nor will local AI models; use APIs instead.
- No ports open to the internet: any incoming requests arrive over HTTPS on your domain only.
- Cron-based restarts happen within a minute, so the bot may show offline briefly after a crash.
On ArabyHost
Order an AI and Developer plan, enable SSH from the Araby Panel, upload the bot and add the cron job above. Stop the copy running on your own computer before starting it on the server, so two instances don’t both answer the same commands. If something fails at startup, use the Araby AI assistant or our Arabic-speaking support.
FAQ
Do I need an open port or a domain for a Discord bot?
Usually not. The bot opens an outbound WebSocket to Discord, so it needs no open port and no domain. You only need a domain and SSL if you receive commands through an Interactions Endpoint URL.
Why does my Discord bot stop on free hosting?
Many free plans stop an app that gets no web traffic, or cap running hours per month, and a Discord bot gets no web traffic at all. A bot serving active servers needs a process that doesn't sleep.
Is this hosting suitable for music and voice bots?
Not really. Voice bots encode and stream audio continuously, using CPU and bandwidth the whole time they play, and they quickly reach the resource limits of any shared plan. Command, moderation and reply bots are what it suits.