Skip to content

Configuring

Jack Noordhuis edited this page Jan 11, 2019 · 1 revision

When the plugin first runs it will generate the default Settings.yml configuration file. You should then make sure the server is stopped before modifying the config.

Configuring the plugin is an easy task once you understand the format, we'll start with how to configure the default channel. The beginning of the config should look like this:

Configuring the default channel

###  Discord-Relay v0.0.1-ALPHA configuration file  ###
general:
  # The default channel messages are relayed to and from discord.
  # Will respect both relay-from-discord and relay-to-discord flags (can be set to only relay one way.)
  default-channel: general

The configuration option present here is pretty self explanatory here and even has a comment to explain it. This directive will specify the default channel to relay messages to and from discord, you can disable this functionality fully or partially by specifying the relay-from-discord and/or relay-to-discord flags for the channel or by simply leaving the directive blank.

Configuring Normal Channels

Now that you know how to setup the default channel we'll dive right on into actually setting up channels. A simple default channel looks something like this:

channels:
  - name: general
    discord-id: Discord ID
    options:
      relay-from-discord: true
      relay-to-discord: true

The name of your channel is also referred to as the server alias as it is what the server uses as the channels display name, and it doesn't have to match the channel name on discord. However, the discord-id directive does have to match the discord channel id, this is what the plugin uses internally to identify and differentiate channels. Here is a guide on how to retrieve a channels id.

Now for the customization part, the options directive is where you specify what the plugin will do with this channel, here is a list of flags you can specify and their meaning:

Other Properties

There are some other optional properties that you may apply to a channels root directive:

embed-color

Specify the color for discord embeds, this property is not required and only used if the embed flag is set.

Note: You may specify properties for each individual console log level that will override this property.

Options Flags

relay-from-discord

channels:
  - name: general
    discord-id: Discord ID
    options:
      relay-from-discord: true

If this flag is present and set to true the plugin will listen for messages from this channel on discord and relay them to the server chat. Currently only the default channel will respect this flag, channel switching in-game will be coming soon.

relay-to-discord

channels:
  - name: general
    discord-id: Discord ID
    options:
      relay-to-discord: true

If this flag is present and set to true the plugin will listen for chat messages on the server and relay them to discord. Currently only the default channel will respect this flag, channel switching in-game will be coming soon.

embed

channels:
  - name: general
    discord-id: Discord ID
    embed-color: 16755200
    options:
      embed: true

If this flag is present and set to true the plugin will send relayed messages as an embed. The embed will respect the embed-color property if specified.

Note: You may specify flags for each individual console log level that will override this flag and the embed-color property.

Configuring console logging channels

Most channels won't be setup to log both console messages and relay messages, so the documentation is split into separate sections, but this is still possible if for some reason your setup requires it.

Console logging can be configured for various log levels with a simple directive:

- name: console
  discord-id: channel ID
  options:
    console-levels: [emergency, alert, critical, error, notice, info, debug]

Or you may want to setup a channel only for errors:

- name: errors
  discord-id: channel ID
  options:
    console-levels: [emergency, alert, critical, error]

It's that simple, but if you want to customise each level a bit more you'll be glad to hear you can :)

Embeds and embed-colors

A plain old message just doesn't cut it in 2019 so you can display your console messages as embeds as well, with per-level customisation.

- name: console
  discord-id: channel ID
  options:
    console-levels:
      info:
        embed: true
        embed-color: 15184935

This will display console info-level messages in a channel as an embed with a custom embed-color. You can specify every level with a custom color if you wish:

- name: console
  discord-id: channel ID
  options:
    console-levels:
      emergency:
        embed: true
        embed-color: 15184935
      alert: []
      critical:
        embed: true
        embed-color: 151884