ChatRoomMessageHandler
Index
Properties
Properties
Callback
Actual action to perform.
Type declaration
Parameters
data: ServerChatRoomMessage
The chat message to handle.
sender: Character
The character that sent the message.
msg: string
The formatted string extracted from the message. If the handler is in "post" mode, all substitutions have been performed.
optionalmetadata: IChatRoomMessageMetadata
The collected metadata from the message's dictionary, only available in "post" mode.
Returns boolean | { msg?: string; skip?: (handler) => boolean }
true if the message was handled and the processing should stop, false otherwise.
optionalDescription
A short description of what the handler does. For debugging purposes
Priority
This handler's priority, used to determine when the code should run.
A chat message handler.
This is used in ChatRoomMessage to perform filtering and actions on the received message. You can register one of those with ChatRoomRegisterMessageHandler if you need to peek at incoming messages.
Message processing is done in three phases:
The handler's priority determines when the handler will get executed:
The return from the callback determines what will happen: if it's true, message processing will stop, making the filter act like a handler. If it's false, then it will continue. You can also return an object with a
msgproperty if the handler is a transformation and wishes to update the message's contents inflight and/or askipproperty if you'd like to cause a subsequent handler to not be called.