Channel

new Channel(config)

Parameters:
Name Type Description
config object
Properties
Name Type Attributes Description
name string

Name of the channel

audience ChannelAudience
description string <optional>
minRequiredRole PlayerRoles <optional>
color string <optional>
formatter Object <optional>
Properties:
Name Type Attributes Description
audience ChannelAudience

People who receive messages from this channel

name string

Actual name of the channel the user will type

color string

Default color. This is purely a helper if you're using default format methods

minRequiredRole PlayerRoles

If set only players with the given role or greater can use the channel

description string
formatter Object <optional>

Methods

formatToReceipient(sender, target, message, colorify) → {string}

How to render the message to everyone else E.g., you may want "chat" to say "Playername chats, 'message here'"

Parameters:
Name Type Description
sender Player
target Player
message string
colorify function
Returns:
string

formatToSender(sender, message, colorify) → {string}

How to render the message the player just sent to the channel E.g., you may want "chat" to say "You chat, 'message here'"

Parameters:
Name Type Description
sender Player
message string
colorify function
Returns:
string

send(state, sender, message)

Parameters:
Name Type Description
state GameState
sender Player
message string