Chat
constChat:object
Defined in: server/api.d.ts:8553
Server-side delivery of structured chat messages to connected clients.
Type Declaration
Section titled “Type Declaration”isDefaultRelay()
Section titled “isDefaultRelay()”isDefaultRelay():
boolean
Checks whether the built-in chat relay is enabled.
Returns
Section titled “Returns”boolean
True when chat is relayed automatically.
sendToAll()
Section titled “sendToAll()”sendToAll(
text,options?):void
Broadcasts a structured chat message to all clients.
Parameters
Section titled “Parameters”string
Message body broadcast to every connected client.
options?
Section titled “options?”Optional author label and color: a Color or a packed 0xRRGGBBAA integer.
author?
Section titled “author?”string
color?
Section titled “color?”number | Color
Returns
Section titled “Returns”void
sendToPlayer()
Section titled “sendToPlayer()”sendToPlayer(
player,text,options?):void
Sends a structured chat message to one player’s owning connection.
Parameters
Section titled “Parameters”player
Section titled “player”Player-owned entity identifying the destination connection.
string
Message body sent to the player.
options?
Section titled “options?”Optional author label and color: a Color or a packed 0xRRGGBBAA integer.
author?
Section titled “author?”string
color?
Section titled “color?”number | Color
Returns
Section titled “Returns”void
setDefaultRelay()
Section titled “setDefaultRelay()”setDefaultRelay(
enabled):void
Enables or disables the built-in player-to-player chat relay.
Parameters
Section titled “Parameters”enabled
Section titled “enabled”boolean
True to relay chat automatically; false to answer playerChat yourself.
Returns
Section titled “Returns”void