Table of Contents

Class ChatRelayPolicy

Namespace
FishMMO.DiscordBot.Services
Assembly
FishMMO-DiscordBot.dll

Decides which in-game chat channels are allowed to be republished to Discord.

public sealed class ChatRelayPolicy
Inheritance
ChatRelayPolicy
Inherited Members

Remarks

This is an allowlist, and it is the only thing standing between the game's chat table and a public Discord channel.

The relay used to be a single negation — "forward everything that is not already a Discord message" — which is a rule that grows the wrong way: every channel added to the game since became publishable by default, and nobody had to decide that it should be. What it published, in practice, was private messages. A whisper is persisted with the recipient's name at the front of the body and the sender's name on the row, so both parties and the full text of the message were posted verbatim into a channel neither of them could see and had never agreed to. Guild and party chat went the same way.

The default is the set of channels a player can already assume is public: anyone standing nearby hears Say, and World, Trade and Region are broadcast to everyone on the shard. A server operator can widen it in configuration, but doing so is now a deliberate act with a name attached rather than the consequence of an enum getting a new member.

Channels that carry an expectation of privacy — Tell, Guild and Party — cannot be enabled through configuration at all. Making them relayable is a decision that needs to be taken in code, with a code review attached to it, not by editing a JSON file. Naming one in configuration is refused and logged.

Constructors

ChatRelayPolicy(IConfiguration, ILogger<ChatRelayPolicy>)

Builds the policy from configuration, falling back to the public-channel default.

public ChatRelayPolicy(IConfiguration configuration, ILogger<ChatRelayPolicy> logger)

Parameters

configuration IConfiguration

Application configuration.

logger ILogger<ChatRelayPolicy>

Logger used to report the effective policy at startup.

Fields

ConfigurationSection

Configuration key holding the allowlist of relayable channel names.

public const string ConfigurationSection = "ChatRelay:GameToDiscordChannels"

Field Value

string

Methods

IsRelayable(byte)

Whether a persisted chat row may be republished to Discord.

public bool IsRelayable(byte channel)

Parameters

channel byte

The stored ChatEntity.Channel byte.

Returns

bool

True only when the channel is explicitly allowed.