Skip to content

Discord ​

The proxy can run a Discord bot. It reports what happens on the network to your staff, and it gives the staff a few slash commands to look things up.

The Discord integration lives on the proxy only. The backend has no Discord code at all, and there is no module toggle for it: the bot runs when there is a token, and it does not run when there is none.

Setting it up ​

1. The bot ​

Create an application on the Discord developer portal and give it a bot user. Copy the token.

WARNING

The bot asks for every gateway intent, including the privileged ones (GUILD_MEMBERS and MESSAGE_CONTENT). Without them the connection to Discord is closed with the error 4014 DISALLOWED_INTENTS. Turn them on in the developer portal under Bot → Privileged Gateway Intents.

2. The token ​

yaml
discord:
  token: "your-token-here"
  activity: "play.example.com"

An empty token means the bot is not started — no bot, no slash commands, and no message in the log. A token that is wrong is logged as Invalid Discord Token, and the proxy keeps running without the bot.

discord.activity is the text of the presence of the bot: the bot shows itself as "playing play.example.com".

3. The channels ​

The bot writes into four channels. A channel with an empty id is switched off.

yaml
discord:
  channels:
    staff-notifications: ""
    reports: ""
    punishments: ""
    log: ""

TIP

A file that was made before the channels existed does get them added on the next start, empty — see what happens to a key that is missing. Fill in the four ids and restart the proxy.

4. The roles ​

yaml
discord:
  staff-roles: []
  admin-roles: []

The two lists do different things:

ListWhat it does
staff-rolesThe roles that are mentioned in the messages of the bot. Only four messages mention them: a report, a staff note, a filtered chat message and the missing-plugins message.
admin-rolesThe roles that may run the slash commands of the bot.

An empty staff-roles means nobody is mentioned — the messages are still posted.

WARNING

An empty admin-roles means nobody may run the slash commands. That is deliberate: the commands hand out the state of the network, and that does not belong to everybody in the guild.

The ids are the Discord role ids — the long numbers, not the names.

What goes into which channel ​

staff-notifications ​

The comings and goings of the staff:

MessageWhen
Staff JoinA staff member joins a server.
Staff LeaveA staff member leaves a server.
Staff SwitchA staff member moves to another server.
Staff Vanish / UnvanishA staff member vanishes or comes back.

The joins and the leaves of the ordinary players are not posted.

reports ​

MessageWhen
ReportA player is reported.
Watch-ListA staff member writes a note about a player.
Bad Language DetectedThe chat filter caught a message.

These three messages mention the staff roles.

punishments ​

Every punishment that is given: a ban, a mute, a kick and their address variants, the temporary ones and the lifts of them. A silent punishment is posted as well — the message says that it was silent.

log ​

MessageWhen
Missing Plugins DetectedA plugin of the required-plugins list is missing.
MaintenanceThe maintenance mode is switched on or off.
Server RestartThe proxy or a backend is restarted.
Crash ReportA server crashed.
Server DownA server stopped answering.

The missing-plugins message mentions the staff roles.

TIP

Only the chat of the global channel reaches Discord. A private message that the filter caught stays between the staff.

The slash commands ​

These are commands in Discord, not in Minecraft. They are guarded by the discord.admin-roles, not by a Minecraft permission, and their answer is only shown to the person who ran them.

CommandWhat it does
/serverstats <server>The figures of a server: the players, the performance, the memory, the worlds, the economy and the figures of the whole network.
/playerstats <player>The figures of a player: the first login, the last login, the balance, the punishments, the sessions and the names.
/playerserverstats <server> <player>The figures of a player on one server: the balance, the homes, the punishments and the toggles.
/search <server> <query>Searches the log of a server. The matches are attached as a file.
/2fa-reset <player>Resets the two-factor of a player. The secret and the trusted addresses are deleted, so he has to set it up again.

The server argument only accepts a server that the proxy knows; the rest of the text is free.

WARNING

/2fa-reset is the only way to reset a two-factor account from Discord, and it throws the account away completely. A player who is online is held from that moment on.

The database of the bot ​

The bot does not keep anything of its own: everything it shows comes from the same MySQL database as the rest of the plugin. A bot without a database shows nothing.

Reading the configuration again ​

/atv reload reads the Discord section again. The bot is only restarted when the token changed — a change of the channels, the roles or the activity alone does not refresh the bot.

Built with VitePress.