
You are lying in bed and a player messages you: "The server is down." You get up, open your laptop, log into the panel, click Start. Two minutes of your life gone for something a bot could do in seconds.
A Discord bot connected to your server panel or game server lets you manage, monitor, and automate without ever opening the panel.
Option 1: DiscordSRV (Plugin-Level Automation)
DiscordSRV is a Minecraft plugin that bridges in-game chat with Discord. It also supports console access through Discord.
Setting Up Console Access
In plugins/DiscordSRV/config.yml, enable the console channel:
DiscordConsoleChannelId: "YOUR_CHANNEL_ID"
Create a private channel in Discord (only admins can see it). Paste the channel ID. Restart the server.
Now you can type Minecraft commands directly in that Discord channel:
say Server restarting in 5 minutes!
stop
whitelist add NewPlayer
ban GriefingPlayer griefing
The bot executes commands as if you typed them in the server console. Lock this channel to admin-only roles.
See our full DiscordSRV setup guide for complete configuration.
Option 2: Pterodactyl API Bot
If your server runs on Pterodactyl (like Space-Node), you can use the Pterodactyl API to control the server from a Discord bot.
What the API Can Do
| Endpoint | Action |
|---|---|
POST /servers/{id}/power | Start, stop, restart, kill the server |
GET /servers/{id}/resources | Get CPU, RAM, disk usage, player count |
POST /servers/{id}/command | Send a console command |
GET /servers/{id} | Get server status and details |
Creating an API Key
In the Pterodactyl panel:
- Click your profile (top right)
- Go to API Credentials
- Create a new API key
- Copy the key (you only see it once)
Simple Discord Bot (Node.js)
Here is a minimal bot that can restart your server:
const { Client, GatewayIntentBits } = require('discord.js');
const fetch = require('node-fetch');
const client = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.MessageContent] });
const PANEL_URL = 'https://panel.yourhost.com';
const API_KEY = 'your-api-key';
const SERVER_ID = 'your-server-id';
client.on('messageCreate', async message => {
if (!message.member.roles.cache.some(r => r.name === 'Admin')) return;
if (message.content === '!restart') {
await fetch(`${PANEL_URL}/api/client/servers/${SERVER_ID}/power`, {
method: 'POST',
headers: {
'Authorization': `Bearer ${API_KEY}`,
'Content-Type': 'application/json',
'Accept': 'application/json'
},
body: JSON.stringify({ signal: 'restart' })
});
message.reply('Server is restarting.');
}
if (message.content === '!status') {
const res = await fetch(`${PANEL_URL}/api/client/servers/${SERVER_ID}/resources`, {
headers: {
'Authorization': `Bearer ${API_KEY}`,
'Accept': 'application/json'
}
});
const data = await res.json();
const state = data.attributes.current_state;
const memory = Math.round(data.attributes.resources.memory_bytes / 1024 / 1024);
const cpu = data.attributes.resources.cpu_absolute.toFixed(1);
message.reply(`Status: ${state} | RAM: ${memory} MB | CPU: ${cpu}%`);
}
});
client.login('your-discord-bot-token');
Host this bot on the same VPS as your panel, or on a separate small server.
Option 3: Pre-Built Bots
If you do not want to code, several pre-built Discord bots work with Minecraft server panels:
| Bot | Features |
|---|---|
| Crafty Controller | Web panel + Discord integration |
| PteroBot | Pterodactyl API integration, power commands |
| YAGPDB + Webhooks | Custom commands that trigger API calls |
Search for "Pterodactyl Discord bot" on GitHub for community-built options.
Automated Alerts
The most valuable automation is crash alerts. If your server goes offline at 3 AM, you want to know immediately instead of waking up to angry messages.
Webhook Alerts
Create a Discord webhook in your alerts channel. Set up a cron job on the server that checks if the Minecraft process is running:
#!/bin/bash
# Check every 5 minutes if the server is online
if ! curl -s "https://panel.yourhost.com/api/client/servers/$SERVER_ID/resources" \
-H "Authorization: Bearer $API_KEY" \
-H "Accept: application/json" | grep -q '"running"'; then
curl -H "Content-Type: application/json" \
-d '{"content":"The Minecraft server is DOWN. Check the panel."}' \
"https://discord.com/api/webhooks/YOUR_WEBHOOK_URL"
fi
Add to crontab:
*/5 * * * * /home/user/check-server.sh
This pings your Discord channel if the server is not running. Simple and effective.
Scheduled Tasks
Use cron or your panel's scheduler to automate routine tasks:
| Task | Schedule | Command |
|---|---|---|
| Daily restart | 4:00 AM | Power signal: restart |
| Backup reminder | Sunday 2:00 AM | Discord webhook message |
| Player count log | Every hour | API check + log to file |
| World border warning | Before expansion events | Console command via API |
Security Considerations
- Never share API keys in public channels or repositories
- Restrict bot commands to admin-only Discord roles
- Use a separate API key for the bot (so you can revoke it without affecting panel access)
- The console channel in DiscordSRV gives full server access, so lock it down
Space-Node's Pterodactyl panel includes a full API for automation. Create bots, set up monitoring, and automate your server management. Get started here.
Host your Minecraft automation Discord bot 24/7 on Space-Node
