Skip to content

Advanced Configuration

DenisD3D edited this page Jan 29, 2025 · 11 revisions

Configuration file location: /<server_directory>/config/mc2discord.toml
After editing: use /mc2discord restart to apply the change

This page is for Mc2Discord 4.x, if you are using 3.x see: Advanced Configuration for 3.x

Use Minecraft commands on discord

Mc2Discord enables to use all Minecraft commands from Discord. Under the [Commands] section, One [[Commands.Permission]] block set permission for one Discord member or role. Duplicate it as you see fit. Set id to the Discord member or role ID (How to get a discord ID) that match the permission (id = 0 ⇔ apply to everyone). Then, you can list accessible commands in commands and/or give access to a Minecraft permission level. Eg:

[Commands]
    [[Commands.Permission]]
        id = 0
        commands = ["help", "list", "weather clear"]
        permission_level = 1
        comment = "Give permission to everyone use all basic command + /help + /list + /weather clear"
    
    [[Commands.Permission]]
        id = 398486141843800074
        commands = []
        permission_level = 4
        comment = "Give permission to 398486141843800074 to use all OP commands"

/!\ To avoid conflict with Discord slash commands, the default prefix for commands is !. this means you need to use !help instead of /help

Add a logs channel

Mc2Discord enables forwarding server logs to a discord channel (except in 1.12.2). In a channel block, subscribe to logs message type. Eg:

[[Channels.Channel]]
    id = 123456789123456789
    subscriptions = ["logs", "command"]
    mode = "WEBHOOK"

Enable account linking

With account linking you can know which Discord account belong to which player, give/require role on Discord to players, whitelist to members on your Discord. To enable account linking set account_linking to true under the [Features] section. Then, reload the config with /mc2discord restart to generate the new part of the config. You should now have the [Account] section. Set guild_id to your Discord server ID (How to get a discord ID). You also need to enable the SERVER_MEMBERS_INTENT on your Discord bot page for all features to work properly (How to enable the SERVER_MEMBERS_INTENT). Eg:

[Account]
    guild_id = 560085454704214051
    force_link = true  # true or false
    
    [[Account.Policy]]
        required_roles_id = [566633577362620446]  # require this role to link account (eg: Rules Accepted role)
        roles_id_to_give = [560085616315072512]   # this role will be given to linked players (eg: Player role)

Add colors (and other formatting) to in-game messages

You can format in-game messages using the Minecraft formatting variables. They work the same way as other variables. Eg:

minecraft_chat_format = "<${color_start|#FF0000}Discord${color_end} - ${color_start|top_role}${member_display_name}${color_end}> ${bold_start}${reply}${message}${bold_end}"

Chat formatting

Add random messages

By replacing a message by an array of string, the mod will randomly pick one message to send. Eg:

start = ["The server has started", "Server is up, let's start playing!", "Who is it ? It's the server!"]

This may be used in all fields under [Messages] and [Account.Messages]. It may also be used for Presence and Status messages