Skip to content

Variables

DenisD3D edited this page Sep 6, 2023 · 16 revisions

Mc2Discord provide a few variables you can use to make messages dynamic. Eg : If you want the player name to be displayed in a message, you can use the ${player_display_name} variable. It will then be replaced (${player_display_name} joined the game become Superman joined the game). The variables available for a field are written in the comment.

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

Global variables

Variables Descriptions
- ${online_players} The number of player currently connected to the server
- ${max_players} The number of slots on the server
- ${unique_players} The number of unique players who have joined the server
- ${motd} The motd of the server
- ${mc_version} The Minecraft version of the server
- ${server_hostname} The hostname of the server
- ${server_port} The port of the server
- ${now|FORMAT} The current datetime with FORMAT a valid date time format eg : yyyy/MM/dd HH:mm:ss
- ${uptime|FORMAT} The time since the server started with FORMAT a valid date time format eg : HH:mm:ss
- ${bot_name} The Discord bot name
- ${bot_discriminator} The Discord bot discriminator
- ${bot_id} The Discord bot ID
- ${bot_display_name} Mc2Discord display name
- ${bot_avatar_url} Mc2Discord display avatar

Player variables

Variables Descriptions
- ${player_name} The player account name
- ${player_display_name} The player name displayed ingame (with preffix, suffix, team, ...)
- ${player_uuid} The player uuid (usefull for avatar api)

Advancement variables

Variables Descriptions
- ${advancement_title} The title of the advancement
- ${advancement_description} The description of the advancement
- ${advancement_display_text} The advancement display text
- ${advancement_path} The minecraft internal advancement name

Death variables

Variables Descriptions
- ${death_message} The complete death message
- ${death_damage_type} The type of damage that killed the player (usefull for emoji)
- ${death_combat_duration} The duration of the combat
- ${death_attacker_name} The name of the killer (name of a mob or another player)
- ${death_attacker_health} The amount of health remaining to the killer

Message variable

Variables Descriptions
- ${message} The content to send

Discord member variables

Variables Descriptions
- ${member_display_name} The name of that the member appear with on the Discord server
- ${member_global_name} The member global display name
- ${member_username} The member @username
- ${member_nickname} The nickname of the member on the Discord server
- ${member_avatar_url} The URL of the profile picture of the member
- ${member_top_role_color} The hex color of the top Discord top role (color of the Member)

Logging variables

Variables Descriptions
- ${log_logger_name} The name of the logger
- ${log_thread_name} The name of the thread the log is comming from
- ${log_time|FORMAT} The datetime the log was sent with FORMAT a valid date time format eg : HH:mm:ss
- ${log_level} The logging level of the log (INFO, WARN, DEBUG, ...)
- ${log_message} The message contained in the log

Formatting variables

Variables Descriptions
- ${color_start|COLOR} XXX ${color_end} Change the text color with COLOR being a hex color or top_role for the color of the Member (if available)
- ${bold_start} XXX ${bold_end} Change text style to bold
- ${italic_start} XXX ${italic_end} Change text style to italic
- ${underlined_start} XXX ${underlined_end} Change text style to underline
- ${strikethrough_start} XXX ${strikethrough_end} Change text style to strikethrough
- ${obfuscated_start} XXX ${obfuscated_end} Change text style to obfuscated