Developing 7/24 Discord.js v14 Bots and Managing with PM2
Step-by-step guide to building a Discord.js v14 bot, slash commands, and hosting it 24/7 using PM2 process manager.
Yoxlanıldığı versiya
- discord.js
- v14
- Node.js
- 20 / 22
- PM2
- 5.x
- Son yoxlama
- 2026-09-13
Discord.js v14 is the modern standard for Discord bot development, enforcing Gateway Intents and Slash Commands. To keep your bot online when your PC shuts down, it must be hosted 24/7 on a cloud server.
Discord Gateway & PM2 Process Supervisor Pipeline
Persistent websocket connection architecture with sub-second crash recovery managed by PM2.
Discord Gateway
Establishes an encrypted WSS websocket session with Discord.
Heartbeat & ACK
Heartbeat packets sustain the connection and compute latency.
PM2 Supervisor
Monitors memory leaks and thread health continuously.
Crash Auto-Recovery
Crashed processes are restarted automatically, with no manual step.
Always-On Bot
The bot keeps running in the background; closing your session does not stop it.

Clodo NVMe Cloud Server
Clodo PM2 & Node.js Process Monitor
Track your bot's memory footprint, real-time log output, and uptime stats.
1. Modern Discord.js v14 Starter Template#
import { Client, GatewayIntentBits } from "discord.js";
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
],
});
client.once("ready", () => {
console.log(`✅ Bot aktif: ${client.user.tag}`);
});
client.on("interactionCreate", async (interaction) => {
if (!interaction.isChatInputCommand()) return;
if (interaction.commandName === "ping") {
await interaction.reply({ content: "🏓 Pong!", ephemeral: true });
}
});
client.login(process.env.DISCORD_TOKEN);2. Running 24/7 with PM2 Process Manager#
PM2 is a production process manager that keeps Node.js applications alive forever, auto-restarting them on crashes:
npm install -g pm2
pm2 start index.js --name "clodo-bot"
# Sunucu yeniden basladiginda otomatik baslamasi icin:
pm2 startup
pm2 save3. Bot Hosting Methods Compared#
Bunu necə tətbiq etmək olar?
Clodo Discord Bot Managed Hosting
Instant Bot Runtime & Web ConsoleZero Linux maintenance; Node.js and Python runtimes are pre-installed with real-time web console.
Addım-addım icra:
- 1No OS setup required; switch between Node.js 18, 20, 22 in one click.
- 2Store tokens securely inside the encrypted Environment Variables vault.
- 3Built-in watchdog daemon detects unexpected process exits and restarts instantaneously.
- 4View rich colored stdout/stderr streams directly in your browser console.
Bu bələdçi faydalı oldu?
Rəy birbaşa bu bələdçini yeniləyən komandaya gedir.
Əlaqəli bələdçilər
Developing Async Python Discord Bots with discord.py and 24/7 Hosting
Build modern slash command bots using discord.py 2.0+, virtual environments, and continuous daemon supervision.
Continuous Deployment: Auto-Deploying to VPS via GitHub Webhooks
Trigger automatic git pulls, builds, and graceful process restarts upon every repository push.

