Options
All
  • Public
  • Public/Protected
  • All
Menu

The client-side ChatMessage document which extends the common BaseChatMessage model.

mixes

ClientDocumentMixin

see

{@link documents.Messages} The world-level collection of ChatMessage documents

Hierarchy

  • any
    • ChatMessage

Index

Constructors

  • Returns ChatMessage

Properties

logged: boolean = false

Is this ChatMessage currently displayed in the sidebar ChatLog?

rolls: any
_rollExpanded: boolean = false

Is the display of dice rolls in this message collapsed (false) or expanded (true)

Accessors

  • get alias(): string
  • Return the recommended String alias for this message. The alias could be a Token name in the case of in-character messages or dice rolls. Alternatively it could be the name of a User in the case of OOC chat or whispers.

    Returns string

  • get isAuthor(): boolean
  • Is the current User the author of this message?

    Returns boolean

  • get isContentVisible(): boolean
  • Return whether the content of the message is visible to the current user. For certain dice rolls, for example, the message itself may be visible while the content of that message is not.

    Returns boolean

  • get isRoll(): boolean
  • Test whether the chat message contains a dice roll

    Returns boolean

  • get visible(): boolean
  • Return whether the ChatMessage is visible to the current User. Messages may not be visible if they are private whispers.

    Returns boolean

Methods

  • prepareDerivedData(): void
  • inheritdoc

    Returns void

  • applyRollMode(rollMode: string): void
  • Update the data of a ChatMessage instance to apply a requested rollMode

    Parameters

    • rollMode: string

      The rollMode preference to apply to this message data

    Returns void

  • getRollData(): any
  • Obtain a data object used to evaluate any dice rolls associated with this particular chat message

    Returns any

  • getHTML(): Promise<jQuery>
  • Render the HTML for the ChatMessage which should be added to the log

    Returns Promise<jQuery>

  • _preCreate(data: any, options: any, user: any): Promise<void>
  • override

    Parameters

    • data: any
    • options: any
    • user: any

    Returns Promise<void>

  • _onCreate(data: any, options: any, userId: any): void
  • override

    Parameters

    • data: any
    • options: any
    • userId: any

    Returns void

  • _onUpdate(data: any, options: any, userId: any): void
  • override

    Parameters

    • data: any
    • options: any
    • userId: any

    Returns void

  • _onDelete(options: any, userId: any): void
  • override

    Parameters

    • options: any
    • userId: any

    Returns void

  • export(): string
  • Export the content of the chat message into a standardized log format

    Returns string

  • _renderRollContent(messageData: any): Promise<any>
  • Render the inner HTML content for ROLL type messages.

    Parameters

    • messageData: any

      The chat message data used to render the message HTML

    Returns Promise<any>

  • applyRollMode(chatData: any, rollMode: string): any
  • Transform a provided object of ChatMessage data by applying a certain rollMode to the data object.

    Parameters

    • chatData: any

      The object of ChatMessage data prior to applying a rollMode preference

    • rollMode: string

      The rollMode preference to apply to this message data

    Returns any

    The modified ChatMessage data with rollMode preferences applied

  • Attempt to determine who is the speaking character (and token) for a certain Chat Message First assume that the currently controlled Token is the speaker

    Parameters

    Returns any

    The identified speaker data

  • getSpeakerActor(speaker: any): Actor
  • Obtain an Actor instance which represents the speaker of this message (if any)

    Parameters

    • speaker: any

      The speaker data object

    Returns Actor

  • getWhisperRecipients(name: string): User[]
  • Given a string whisper target, return an Array of the user IDs which should be targeted for the whisper

    Parameters

    • name: string

      The target name of the whisper target

    Returns User[]

    An array of User instances

  • _getSpeakerFromToken([options={}]: { token: TokenDocument; alias: string }): any
  • A helper to prepare the speaker object based on a target TokenDocument

    Parameters

    • [options={}]: { token: TokenDocument; alias: string }

      Options which affect speaker identification

    Returns any

    The identified speaker data

  • _getSpeakerFromActor([options={}]: { scene: Scene; actor: Actor; alias: string }): any
  • A helper to prepare the speaker object based on a target Actor

    Parameters

    • [options={}]: { scene: Scene; actor: Actor; alias: string }

      Options which affect speaker identification

    Returns any

    The identified speaker data

  • _getSpeakerFromUser([options={}]: { scene: Scene; user: User; alias: string }): any
  • A helper to prepare the speaker object based on a target User

    Parameters

    • [options={}]: { scene: Scene; user: User; alias: string }

      Options which affect speaker identification

    Returns any

    The identified speaker data