Skip to content

Customization

TheFloatingPixel edited this page Sep 25, 2022 · 2 revisions

DiscordLog allows you to customize what events will be logged, and the log messages themselves. This page shows how to change them!

Customizing logged events

To customize logged events, you should add or remove items from the logged-events list. Commenting out the lines that you don't want will also work. You can find the list of all available events here.

Examples

logged-events:
  - player-join
  - player-disconnect

This configuration will only log players connecting and disconnecting from the server

logged-events:
#   Commenting out the stuff that you don't want also works
#  - player-command-execution
#  - console-command-execution
#  - player-join
#  - player-disconnect
#  - player-kick
  - player-death
#  - player-respawn
  - player-kill-entity
  - player-kill-named-entity

This configuration will only log players killing entities and dying themselves

logged-events:
  - player-command-execution
  - console-command-execution
  - player-join
  - player-disconnect
  - player-kick
  - player-death
  - player-respawn
  - player-kill-entity
  - player-kill-named-entity

This configuration will log everything

Customizing log messages

Log messages can also be customized. They can have embedded arguments, and use discord-specific formatting.

To change a log message, change the text of it in the messages section.

Example

messages:
  player-command: "Someone just sent a command." # The default is "Player **#{player}** executed the command ``#{command}``"

Discord Formatting

Format Syntax Result
Bold **Bold text** obraz
Italic _Italic text_ obraz
Underline __Underlined text__ obraz
Strikethrough ~~Strikethrough~~ obraz
Spoiler ||Spoiler|| obraz
Blockquote > Quote obraz
Inline code `/say hello` obraz

Example

messages:
  player-command: "**Someone just sent a command in bold.**"

Embedding arguments

Embedded arguments are a way to insert context-specific text into a message. The syntax for embedding an argument is #{<argument name>}.

For example a message defined in the config as this

messages:
  player-command: "Player **#{player}** executed the command ``#{command}``"

could result in one of the following messages (depending on the command executed and player sending the command) obraz obraz

Warning

The backtick (`) is an escape character in parameters (eg. `#{param} will render as #{param}, whereas #{param} would show the value of param). If you want to use the discord inline code formatting syntax, you have to use a double backtick (``). The syntax for a parameter wrapped in inline code would be ``#{param}``

Emojis

Log messages can also use Discord emojis, for example:

messages:
  player-command: ":desktop: Player **#{player}** executed the command ``#{command}``"

If you want to use a server-specific emoji, do this:

  1. Select the emoji from the emoji panel
  2. Add a backslash (\) before the emoji
  3. Send the message (it should look something like this: <:barrier:12345678901234567>)
  4. Copy the resulting message and paste it into your config

The resulting config would be:

messages:
  player-command: "<:barrier:12345678901234567> Player **#{player}** executed the command ``#{command}``"