ChatLog

ChatLog

The sidebar directory which organizes and displays world-level ChatMessage documents.

Constructor

new ChatLog(optionsopt)

See:
Parameters:
Name Type Attributes Description
options ChatLogOptions <optional>

Application configuration options.

Extends

Members

(static) defaultOptions

_original :SidebarTab

Overrides:

Denote whether or not this is the original version of the sidebar tab, or a pop-out variant

Type:

(protected) _popout :SidebarTab

Overrides:

A reference to the pop-out variant of this SidebarTab, if one exists

Type:

collection :Messages

A reference to the Messages collection that the chat log displays

Type:

tabName :string

Overrides:

The base name of this sidebar tab

Type:
  • string

Methods

(static) _setRollMode(mode)

Update roll mode select dropdowns when the setting is changed

Parameters:
Name Type Description
mode string

The new roll mode setting

(static) parse(message) → {Array.<string>}

Parse a chat string to identify the chat command (if any) which was used

Parameters:
Name Type Description
message string

The message to match

Returns:

The identified command and regex match

Type
Array.<string>

_contextMenu()

_onLazyLoadImage(entries, observer)

Overrides:

Handle lazy loading for sidebar images to only load them once they become observed

Parameters:
Name Type Description
entries Array.<HTMLElement>

The entries which are now observed

observer IntersectionObserver

The intersection observer instance

(async) _render()

Overrides:

(async) _renderInner()

Overrides:

activate()

Overrides:

Activate this SidebarTab, switching focus to it

activateListeners()

(async) close()

Inherited From:

createPopout() → {SidebarTab}

Overrides:

Create a second instance of this SidebarTab class which represents a singleton popped-out container

Returns:

The popped out sidebar tab instance

Type
SidebarTab

deleteMessage(messageId, deleteAllopt)

Delete a single message from the chat log

Parameters:
Name Type Attributes Description
messageId string

The ChatMessage document to remove from the log

deleteAll boolean <optional>

Is this part of a flush operation to delete all messages?

getData()

notify()

Trigger a notification that alerts the user visually and audibly that a new chat log message has been posted

(async) postOne(message, notifyopt, optionsopt) → {Promise.<void>}

Post a single chat message to the log

Parameters:
Name Type Attributes Default Description
message ChatMessage

A ChatMessage document instance to post to the log

notify boolean <optional>
false

Trigger a notification which shows the log as having a new unread message

options object <optional>
{}

Additional options for how the message is posted to the log

Properties
Name Type Attributes Description
before string <optional>

An existing message ID to append the message before, by default the new message is appended to the end of the log.

Returns:

A Promise which resolves once the message is posted

Type
Promise.<void>

(async) processMessage(message) → {Promise.<(Object|void)>}

Prepare the data object of chat message data depending on the type of message being posted

Parameters:
Name Type Description
message string

The original string of the message content

Returns:

A Promise resolving to the prepared chat data object, or void if we were executing a macro instead.

Type
Promise.<(Object|void)>

renderPopout()

Overrides:

Render the SidebarTab as a pop-out container

(async) updateMessage(message, notify)

Update the content of a previously posted message after its data has been replaced

Parameters:
Name Type Default Description
message ChatMessage

The ChatMessage instance to update

notify boolean false

Trigger a notification which shows the log as having a new unread message

updateTimestamps()

Update the displayed timestamps for every displayed message in the chat log. Timestamps are displayed in a humanized "timesince" format.