3.X.X - GeheimagentNr1/DiscordIntegration GitHub Wiki

This Mod connects the Minecraft chat with a discord chat.
The Mod adds Discord command integration for the Mods Dimension Access Manager and More MobGriefing Options.
This Mod only works on the server side and won't work on the client side.

Important Notes

  • When sharing a world of a server, where Discord Integration is installed, remember to remove "discordintegration-server.toml" file in the "serverconfig" folder, to protect your bot token.
  • You can regenerate the bot token in the Discord Developers Site on the "Bot tab".

Support

Support Supported Minecraft Versions
New Development and Fixes 1.20.4
Bug Fixes 1.19.4
Critical Bug Fixes 1.18.2, 1.20-1.20.2
End of Support up to 1.18.1, 1.19-1.19.3

Features

Chat

Minecraft > Discord

Everything written in the Minecraft chat is added to the Discord chat by a Discord bot.
Additional death messages, advancements messages are sent to Discord.
The "say"- and the "me"-command has been changed and sent their messages to Discord too.
Server started and server stopped messages can be customized in the config.

Discord > Minecraft

Every message except from bots are sent to the Minecraft chat.
Bot messages can be sent to the Minecraft chat, if it is activated in the config.
The max length of messages transmitted from Discord to Minecraft can be configured to prevent spam. An error message is shown in the Discord chat, if the message is too long.
Messages, which are commands, are also not sent to the Minecraft chat.
There are default commands added by Discord Integration, custom commands can be added in the config. The command prefix can be configured in the config too.

Management

The "management" part of Discord Integration consists of two parts, the management channel and the management role.
In the management channel, all Discord Integration commands can be used. Also, messages about server start, stop and crash, player joined and left are shown. If the whitelist feature is activated, additional messages will be shown, if a Minecraft and Discord account are linked or unlinked and if a Minecraft account is added or removed from the whitelist.
Additionally, the management channel can be used for conversations between the moderators and admins of the Minecraft server, which will not be shown in the Minecraft chat.
With the management role commands can be executed that are marked as management commands.

Whitelist

From the whitelist usable by Discord Integration requires the whitelist to be activated in the server.properties file. It has two mechanisms to secure the whitelist, role and single link management, which are described in the following sections. Linkings from users leaving the Discord server will automatically be removed. If the linkings are out of sync, for example because the Minecraft server was offline or the Discord API had issues, this can be solved by restarting the server, which resyncs the linkings. The config key "whitelist.use_role" is used to set, if the use role mechanism is active, and the config key "whitelist.use_single_linking_management" is used to set, if the single link management is active. To create linkings users can use the "!link" and "!unlink" commands in the chat channel. Important: The "!link" and "!unlink" commands have to be enabled in the config, before they can be used.

Only linking

If both mechanisms are deactivated, the user only has to create a linking to get onto the whitelist.

Role

If the role mechanism is active, the user has to have the role whose ID is set to the config key "whitelist.role_id". The role has to be assigned by a moderator of the Discord server. If the "@everyone" role is used, the user just has to create a liking to get onto the whitelist.

Single Link Management

For the Single Link Management two config values have to be set. The "whitelist.linking_management_channel_id" has to have the channel ID set of the channel in which the "Linking Messages" are shown. The "whitelist.single_linking_management_role_id" is the role ID of the role that is needed to activate or deactivate a linking. The linking can be simply activated or deactivated by clicking the tick or "X" reaction below the message.
On startup, all linking messages in the link management channel are updated, this takes about 1 second per message due to Discord API restrictions.
Example Link Management Message

Role + Single Link Management

The Discord user has to have the role assigned, whose ID is set to the config variable "whitelist.role_id" and the link has to be activated in the link management channel (details in the previous section).

Minecraft Commands

  • /discord commands - shows the list of available commands configured in the Discord Integration with a help message what they do.
  • /discord gamerules - shows the values of all Minecraft gamerules.
  • /discord mods - shows a list of all mods in the server.
  • /discord link <player> [<discordMemberId>] - creates a linking between a Discord user and a Minecraft player. From the Discord chat only the variate with only the player can be user and in Minecraft only with player and discordMemberId the command is usable (Only of players with op level 3 or higher).
  • /discord unlink <player> [<discordMemberId>] - deletes a linking between a Discord user and a Minecraft player. From the Discord chat only the variate with only the player can be user and in Minecraft only with player and discordMemberId the command is usable (Only of players with op level 3 or higher).

Default Discord Commands

If you type the following commands into the discord chat, you get information from the Minecraft server.
Custom commands can be added in the config.

Commands for Vanilla Minecraft

  • !difficulty - shows the difficulty of the server.
  • !gamerules - shows the gamerules and their values.
  • !help - shows all commands with its description.
  • !link <Minecraft player name> - links a Minecraft player with the Discord user using this command.
  • !mods - shows a list of the mods on the server.
  • !online - shows how many and which players are on the server.
  • !seed - shows the seed of the active world.
  • !time - shows the current day time on the server.
  • !tps - shows the tps statistic of the server, and it's dimensions.
  • !unlink <Minecraft player name> - unlinks a Minecraft player from the Discord user using this command.

Commands for the Dimension Access Manager Mod

  • !dimensions - shows the access states of all dimensions.

Commands for the More MobGriefing Options Mod

  • !mobgriefing - shows all mobgriefing options of the mobs.

Server Config

The config file can be found in the "serverconfig" folder in the "world" folder and is named "discordintegration-server.toml". The name of the world folder is set for servers in the "server.properties" file.

  • bot
    General bot configuration
    • active
      Should the Discord Integration be active?
      Default: false
    • bot_token
      Token of your Discord bot
      Default: "INSERT BOT TOKEN HERE"
    • guild_id
      Guild/Server ID of the Discord server, where the Discord Integration should operate.
    • discord_presence
      Discord Presence configuration
      • show_discord_presence
        Shall a Discord Presence message be shown?
        Default: false
      • message
        Message shown in the Discord Presence (activity is always playing). (Available parameters: %online_player_count% = Online Player Count, %max_player_count% = Max Player Count)
        Default: "Minecraft with %online_player_count% players"
  • chat
    Chat channel settings
    • enabled
      Should the Minecraft and Discord chat be linked?
      Default: false
    • channel_id
      Channel ID where the Minecraft and Discord chat will be linked.
    • use_raw_message_format_discord_to_minecraft
      Use raw message format for Discord to Minecraft messages (examples: https://minecraft.fandom.com/wiki/Commands/tellraw#Examples)?
      Default: false
    • invalid_raw_message_format_for_discord_to_minecraft_error_message
      Error message shown in Discord, if the raw message format is malformed JSON. (Available parameters: %username% = Discord username, %nickname% = Discord nickname, %error_message% = Error message, %new_line% = New line)
      Default: "%username%%new_line%Error: Invalid JSON format for raw message for Discord to Minecraft message.%new_line%%error_message%"
    • message_format_discord_to_minecraft
      Message format for Discord to Minecraft messages. (Available parameters: %username% = Discord username, %nickname% = Discord nickname, %message% = Message)
      Default: "[%username%] %message%"
    • message_format_minecraft_to_discord
      Message format for Minecraft to Discord messages. (Available parameters: %player% = Player name, %message% = Message)
      Default: "%player% %message%"
    • message_format_minecraft_to_discord_me_message
      Message format for Minecraft's /me command to Discord messages. (Available parameters: %player% = Player name, %message% = Message)
      Default: "%player% %message%"
    • max_char_count
      How long should Discord messages sent to Minecraft chat be at most? If the value is -1, there is no limit to the length.
      Default: -1
    • max_char_count_error_message
      Error message shown in Discord, if the message is too long. (Available parameters: %username% = Discord username, %nickname% = Discord nickname, %max_char_count% = Max message length (value of chat.max_char_count), %actual_message_char_count% = Actual length of the send message, %new_line% = New line)
      Default: "%username%%new_line%Error: Message too long.%new_line%Messages can only be up to %max_char_count% characters long.%new_line%Your message is %actual_message_char_count% characters long."
    • transmit_bot_messages
      Should messages of other bots be sent to the Minecraft chat?
      Default: false
    • suppress_server_messages
      Suppress messages sent from the Minecraft server (for example, with the say command)?
      Default: false
    • messages
      Messages shown on Discord in the chat channel
      • server_started
        Options for the server start message
        • enabled
          Should a message be sent to the Discord chat, if the server started?
          Default: true
        • message
          Message sent to the Discord chat, if the Minecraft server started.
          Default: "Server started"
      • server_stopped
        Options for the server stop message
        • enabled
          Should a message be sent to the Discord chat, if the server stopped?
          Default: true
        • message
          Message sent to the Discord chat, if the Minecraft server stopped.
          Default: "Server stopped"
      • server_crashed
        Options for the server crash message
        • enabled
          Should a message be sent to the Discord chat, if the server crashed?
          Default: true
        • message
          Message sent to the Discord chat, if the Minecraft server crashed.
          Default: "Server crashed"
      • player_joined
        Options for the player joined message
        • enabled
          Should a message be sent to the Discord chat, if a player joined?
          Default: true
        • message
          Message sent to the Discord chat, if a player joined. (Available parameters: %player% = Player name)
          Default: "%player% joined the game."
      • player_left
        Options for the player left message
        • enabled
          Should a message be sent to the Discord chat, if a player left?
          Default: true
        • message
          Message sent to the Discord chat, if a player left the server. (Available parameters: %player% = Player name)
          Default: "%player% disconnected."
      • player_died
        Options for the player died message
        • enabled
          Should a message be sent to the Discord chat, if a player died?
          Default: true
        • message
          Message sent to the Discord chat, if a player died. (Available parameters: %player% = Player name, %default_message% = Default death message shown in the chat with bold player name)
          Default: "%default_message%"
      • tamed_mob_died
        Options for the tamed mob died message
        • enabled
          Should a message be sent to the Discord chat, if a tamed mob left?
          Default: true
        • message
          Message sent to the Discord chat, if a tamed mob died. (Available parameters: %tamed_mob% = Tamed mob name, %default_message% = Default death message shown in the chat with bold tamed mob name)
          Default: "%default_message%"
      • player_got_advancement
        Options for the player got advancement message
        • enabled
          Should a message be sent to the Discord chat, if a player got an advancement?
          Default: true
        • message
          Message sent to the Discord chat, if a player got an advancement. (Available parameters: %player% = Player name, %advancement_title% = Advancement title, %advancement_description% = Advancement description, %new_line% = New line)
          Default: "%player% has made the advancement%new_line%%advancement_title%%new_line%%advancement_description%"
  • management
    Management channel settings
    • enabled
      Should a management channel be used?
      Default: false
    • channel_id
      Channel ID, where the management channel should be.
    • role_id
      Role ID, which Discord users need to execute management commands
    • messages
      Messages shown on Discord in the management channel
      • server_started
        Options for the server start message
        • enabled
          Should a message be sent to the Discord management channel, if the server started?
          Default: true
        • message
          Message sent to the Discord management channel, if the Minecraft server started.
          Default: "Server started"
      • server_stopped
        Options for the server stop message
        • enabled
          Should a message be sent to the Discord management channel, if the server stopped?
          Default: true
        • message
          Message sent to the Discord management channel, if the Minecraft server stopped.
          Default: "Server stopped"
      • server_crashed
        Options for the server crash message
        • enabled
          Should a message be sent to the Discord management channel, if the server crashed?
          Default: true
        • message
          Message sent to the Discord management channel, if the Minecraft server crashed.
          Default: "Server crashed"
      • player_joined
        Options for the player joined message
        • enabled
          Should a message be sent to the Discord management channel, if a player joined?
          Default: true
        • message
          Message sent to the Discord management channel, if a player joined. (Available parameters: %player% = Player name)
          Default: "%player% joined the game."
      • player_left
        Options for the player left message
        • enabled
          Should a message be sent to the Discord management channel, if a player left?
          Default: true
        • message
          Message sent to the Discord management channel, if a player left the server. (Available parameters: %player% = Player name)
          Default: "%player% disconnected."
      • linking_created
        Options for the linking created message
        • enabled
          Should a message be sent to the Discord management channel, if the a linking is created?
          Default: true
        • message
          Message sent to the Discord management channel, if a linking is created. (Available parameters: %player% = Player name, %username% = Discord username, %nickname% = Discord nickname)
          Default: "%player% added to linkings of discord user %username%"
      • linking_removed
        Options for the linking removed message
        • enabled
          Should a message be sent to the Discord management channel, if the a linking is removed?
          Default: true
        • message
          Message sent to the Discord management channel, if a linking is removed. (Available parameters: %player% = Player name, %username% = Discord username, %nickname% = Discord nickname)
          Default: "%player% removed from linkings of discord user %username%"
      • whitelist_update_with_forced_message_update_start
        Options for the whitelist update with forced message update start message
        • enabled
          Should a message be sent to the Discord management channel, if the process of updating the whitelist with a forced update of all linking messages is started?
          Default: true
        • message
          Message sent to the Discord management channel, if the process of updating the whitelist with a forced update of all linking messages is started.
          Default: "Start whitelist update with forced message update"
      • whitelist_update_with_forced_message_update_finished
        Options for the whitelist update with forced message update finished message
        • enabled
          Should a message be sent to the Discord management channel, if the process of updating the whitelist with a forced update of all linking messages is finished?
          Default: true
        • message
          Message sent to the Discord management channel, if the process of updating the whitelist with a forced update of all linking messages is finished.
          Default: "Finished whitelist update with forced message update"
      • player_whitelist_added
        Options for the player to whitelist added message
        • enabled
          Should a message be sent to the Discord management channel, if a player is added to the whitelist, because of a linking?
          Default: true
        • message
          Message sent to the Discord management channel, if a player is added to the whitelist, because of a linking. (Available parameters: %player% = Player name)
          Default: "%player% added to whitelist"
      • player_whitelist_removed
        Options for the player from whitelist removed message
        • enabled
          Should a message be sent to the Discord management channel, if a player is removed from the whitelist, because of a linking?
          Default: true
        • message
          Message sent to the Discord management channel, if a player is added to the whitelist, because of a linking. (Available parameters: %player% = Player name)
          Default: "%player% removed from the whitelist"
  • whitelist
    Settings for whitelist management in Discord
    • enabled
      Should the whitelist management in Discord be enabled?
      Default: false
    • use_role
      Does the user have to have a specific role to be whitelisted?
      Default: true
    • role_id
      Role ID of the Discord role, that a user have to have to be whitelisted.
    • use_single_linking_management
      Does every linking has to be separately activated, before the Minecraft account is being whitelisted?
      Default: true
    • single_linking_management_role_id
      Role ID of the Discord role, that a user have to have to activate or deactivate the linkings. Only needed if whitelist.use_single_linking_management is true
    • linking_management_channel_id
      Channel ID of the channel, where the activation of the linkings are handled.
  • command_settings
    Command settings
    • command_prefix
      Command prefix for Discord commands
      Default: "!"
    • command_normal_user_permission_level
      Permission level for Minecraft commands for users, who don't have the management role
      Default: 2
    • command_management_user_permission_level
      Permission level for Minecraft commands for users, who do have the management role
      Default: 4
    • other_bots_command_prefixes
      Command prefixes of other bots. Messages with these prefixes are not sent to the Minecraft chat.
    • messages
      Command message settings
      • only_management_command_hint_message
        Message that is shown in the help command as a command description, if a command can only be executed by a Discord user with the management role
        Default: "Only usable by users with the management role"
      • link_created_result_message
        Result message shown, when a Discord user is successfully linked with a Minecraft account. (Available parameters: %username% = Discord username, %nickname% = Discord nickname, %player% = Player name)
        Default: "Created Linking between Discord account "%username%" and Minecraft account "%player%""
      • link_already_exists_result_message
        Result message shown, when a Discord user link with a Minecraft account already exists. (Available parameters: %username% = Discord username, %nickname% = Discord nickname, %player% = Player name)
        Default: "Linking between Discord account "%username%" and Minecraft account "%player%" already exists"
      • link_removed_result_message
        Result message shown, when a Minecraft account is successfully unlinked from a Discord user.(Available parameters: %username% = Discord username, %nickname% = Discord nickname, %player% = Player name)
        Default: "Removed Linking between Discord account "%username%" and Minecraft account "%player%""
      • link_invalid_discord_member_id_error_message
        Message that is shown, when a user could not be found for the Discord server
        Default: "Discord Member does not exist or Discord context is unloadable"
      • unknown_command_error_message
        Error message shown, when a unknown command is entered in the Discord chat (Available parameters: %username% = Discord username, %nickname% = Discord nickname, %new_line% = New line)
        Default: "%nickname%%new_line%Error: Unknown Command"
      • invalid_permissions_error_message
        Error message shown, when a user without the management role tries to execute a management command (Available parameters: %username% = Discord username, %nickname% = Discord nickname, %new_line% = New line)
        Default: "%nickname%%new_line%Error: Invalid permissions, only users with the management role can use this command."
    • commands
      Command mapping from Discord to Minecraft commands
      • minecraft_command
        Minecraft command without prefix ('/')
      • discord_command
        Discord command without prefix
      • management_command
        Should this command only be usable by Discord users with the management role?
      • use_parameters
        Should everything attached to the Discord command, be attached to the Minecraft command, too?
      • description
        Description for the help command(Available parameters: %command% = Command, %command_description_separator% = Command Description Separator)
      • enabled
        Should the command be active?

How to set up a Discord bot and get the bot token

First you have to log into the Discord Developers Site.
Press "New Application" and enter a name for your application.
Go to the "Bot tab" and click "Add Bot".
Discord Developer Page: Bot Tab

Click onto "Click to Reveal Token" to get the bot token for the config.
To add the bot to a server click on "General Information" and add the "Client ID" into the following link:
https://discordapp.com/oauth2/authorize?client_id=YOUR_BOTS_CLIENT_ID&scope=bot&permissions=3072
You have to replace YOUR_BOTS_CLIENT_ID by the client ID of your bot.
Discord Developer Page: General Information Tab

Open this link and add the bot to one of your server.
You can only add the bot to your own servers. If you want to add the bot to a server, that you don't own, you have to check the "Public Bot" option in the Bot tab and let the server owner add the bot to his/her Discord server.

How to get the guild ID

To get the guild ID, you have to go in Discord into the "User Settings" > "Appearance" and have to activate the "Developer Mode"
Discord Developer Mode

Next, you go to the server in which the bot shall operate.
Make a right click on this server name or icon and click "Copy Server ID" and paste it into the config.
Discord Server Menu

How to get the channel ID

To get the channel ID, you have to go in Discord into the "User Settings" > "Appearance" and have to activate the "Developer Mode"
Discord Developer Mode

Next, you go to the server and channel in which the bot shall operate.
Make a right click on the channel and click "Copy ID" and paste it into the config.
Discord Channel Menu

How to get the role ID

To get the role ID, you have to go in Discord into the "User Settings" > "Appearance" and have to activate the "Developer Mode"
Discord Developer Mode

Next, you go to the server in "Server Settings" > "Roles".
Make a right click on the role and click "Copy Role ID" and paste it into the config.
Discord Role Menu

Thanks for the logo to Muse31.
You can use this mod in non-commercial modpacks without asking.
You can find more mods from me here.