DGuard

DiscordSRV: chat, console and roles between Minecraft and Discord

DiscordSRV is a free, open-source plugin that links a Minecraft server to Discord: chat flows both ways, the console goes to its own channel, players link their accounts, and server groups become roles. Setup comes down to a Discord bot, its token and channel IDs. The main trap is the console channel: anything posted there runs as a console command.

The DGuard team7 min read

In short: create an application in the Discord Developer Portal, turn on two privileged intents, put the bot token into BotToken and the channel ID into Channels in plugins/DiscordSRV/config.yml, and restart the server. Only enable the console channel if the owner alone can post in it: DiscordSRV runs any message from there with console rights.

What DiscordSRV does

FeatureFileWhat it does
Chat bridgeconfig.yml, messages.ymlGame chat to a Discord channel and back, plus joins, leaves, deaths and advancements
Console channelconfig.ymlStreams the server log to a channel line by line; messages in the channel run as commands
Alertsalerts.ymlA Discord message when an event or command happens in game
Account linkinglinking.ymlTies a player to a Discord account; can let only linked players join
Synchronizationsynchronization.ymlServer groups ↔ Discord roles, in-game name → Discord nickname
From the DiscordSRV documentation

The plugin runs on Paper, Spigot, Purpur and Folia; current builds on Modrinth support versions up to 26.3. According to its FAQ, DiscordSRV isn't compatible with BungeeCord: install it on each game server, and each one needs its own bot token. Everything below is about the current 1.x line; the next version, Ascension, is still in testing.

Setting up the bot, step by step

  1. 1

    Create an application

    In the Discord Developer Portal, click New Application. On the Installation tab, turn off User Install and set Install Link to None.

  2. 2

    Turn on the intents

    In the bot settings, enable SERVER MEMBERS INTENT and MESSAGE CONTENT INTENT. Leave PUBLIC BOT unchecked so nobody can invite your bot to other servers.

  3. 3

    Get the token

    Click Reset Token, copy the token and paste it into BotToken in config.yml. Changing the token requires a server restart.

  4. 4

    Invite the bot

    Copy the Application ID and invite the bot with https://discordapp.com/oauth2/authorize?scope=bot+applications.commands&client_id= followed by that ID.

  5. 5

    Copy the channel IDs

    Turn on Developer Mode in Discord (User Settings → Advanced → Developer Mode), then right-click a channel → Copy ID.

  6. 6

    Grant permissions and restart

    Give the bot a role. The docs allow the Administrator permission, but granting only what your features need is safer. For role sync, the bot's role must sit above the roles it manages.

plugins/DiscordSRV/config.yml
BotToken: "your-bot-token"
Channels: {"global": "123456789012345678"}
DiscordConsoleChannelId: ""

Channels: what goes where

In Channels, the left side is an in-game channel name and the right side a Discord channel ID. With no other pairs, everything goes to the first channel. Extra pairs split messages up: status for start and stop, deaths for deaths, join and leave for joins and leaves, awards for advancements, link for account linking. With a chat plugin that has channels, the name comes from that plugin. After editing Channels, run /discord reload.

The console channel is riskier than it looks

Anything posted in the DiscordConsoleChannelId channel is run by DiscordSRV as a console command — it doesn't check the author's roles. So the server console belongs to everyone who can post in that channel, and everyone who can grant themselves that right in Discord. The default blocklist only covers ?, op, deop and execute — stop, permission plugin commands and everything else go through.

  • Don't enable it unless you need it. An empty DiscordConsoleChannelId turns it off completely.
  • If you do, the channel is for the owner only. Lock it with Discord permissions for every role but yours, and check who can manage roles and channels.
  • Flip the list to an allowlist. With DiscordConsoleChannelBlacklistActsAsWhitelist: true, only the commands left in DiscordConsoleChannelBlacklistedCommands are allowed.
  • Command log. Every command from the channel is written to Console-<date>.log with the author's ID, and with CancelConsoleCommandIfLoggingFailed: true (the default) a command that can't be logged doesn't run.
  • Commands from chat. The !c prefix in a normal channel also runs console commands: by default say, lag and tps are allowed, and the Owner and Developer roles can run anything. Roles are matched by name or ID — use IDs or turn it off: DiscordChatChannelConsoleCommandEnabled: false.
config.yml — a console channel with allowed commands only
DiscordConsoleChannelBlacklistActsAsWhitelist: true
DiscordConsoleChannelBlacklistedCommands: ["list", "tps"]
DiscordConsoleChannelBlockBots: true
DiscordChatChannelConsoleCommandEnabled: false

It's the same story as RCON: a remote console is full access to the server. Moderators need permissions for their job, not the console — see building a moderation team.

Account linking and roles

A player types /discord link, gets a four-digit code and sends it to the bot in a direct message. Linked players get the Linked role (MinecraftDiscordAccountLinkedRoleNameToAddUserTo), and /discord linked shows the status. In linking.yml you can turn on Require linked account to play — then only players who linked their account and are members of your Discord server can join.

  • Clear `Bypass names`. By default it holds the plugin developers' names: with mandatory linking on, those names join without linking. On an offline-mode server, anyone can take such a name.
  • Group and role sync (synchronization.yml) requires Vault and takes group → role ID pairs. It's two-way by default (GroupRoleSynchronizationOneWay: false). For staff groups, make it one-way from the game to Discord: GroupRoleSynchronizationOneWay: true with GroupRoleSynchronizationMinecraftIsAuthoritative: true. Otherwise whoever hands out roles in Discord also affects groups on the server.

Alerts for moderation

alerts.yml is an advanced feature: a message to a channel when a Bukkit event fires in game or someone runs a command. It's handy for a private staff channel — for example, to see every game mode change. The example below follows a sample from the file's own comments:

plugins/DiscordSRV/alerts.yml
Alerts:
  - Trigger: /gamemode
    Channel: gamemode
    Conditions:
      - '#player.hasPermission("minecraft.command.gamemode") == true'
    Embed:
      Color: "#ff0000"
      Author:
        Name: "${#player.name} changed gamemode to ${#args.get(0)}"

gamemode is an in-game channel name: add a pair for it in Channels with the ID of your private staff channel.

DiscordSRV, moderation and the anticheat

Discord is where most teams already talk, but a moderation log gets lost in general chat, and a console in a channel is a risk. Give each tool its own job. DGuard — the best anticheat for a modern Minecraft server — keeps a punishment log in its panel: every ban with an evidence report, filters and CSV export (turn the log on with cloud.punishment-log: true in the config). Moderators and administrators get access through the Team section with their own email — no password of yours and no console. If a server goes silent for 10 minutes, the owner and the team's administrators get a message on Telegram or by email.

FAQ

Why don't Discord messages show up in game?

Check that both intents, MESSAGE CONTENT INTENT included, are on in the bot settings, and that Channels has the right channel ID. Run /discord reload after editing Channels, and restart after changing the token.

Can I install DiscordSRV on BungeeCord?

No, according to the plugin's FAQ it isn't compatible with BungeeCord. Install it on each game server, each with its own bot token.

Is the console channel safe?

Only if the owner alone can post in it. DiscordSRV runs any message from the channel as a console command, and the default blocklist covers just ?, op, deop and execute.

How do I link a Minecraft account to Discord?

Type /discord link in game, get a four-digit code and send it to the bot in a direct message. /discord linked shows the status.

Sources

All sections

Run the best anticheat for modern Minecraft

DGuard catches all 47 kinds of cheats in our comparison — the closest rival, Intave, has 27. Full protection on every plan, free up to 30 players online.