Represents a poll start event.

Hierarchy (view full)

Constructors

Properties

The possible answers for the poll.

The interpreted kind of poll. Note that this will infer a value that is known to the SDK rather than verbatim - this means unknown types will be represented as undisclosed polls.

To get the raw kind, use rawKind.

maxSelections: number

The maximum number of selections a user is allowed to make.

question: MessageEvent

The question being asked, as a MessageEvent node.

rawKind: string

The true kind as provided by the event sender. Might not be valid.

Accessors

Methods

  • Determines if this event is equivalent to the provided event type. This is recommended over instanceof checks due to issues in the JS runtime (and layering of dependencies in some projects).

    Implementations should pass this check off to their super classes if their own checks fail. Some primary implementations do not extend fallback classes given they support the primary type first. Thus, those classes may return false if asked about their fallback representation.

    Note that this only checks primary event types: legacy events, like m.room.message, should/will fail this check.

    Parameters

    Returns boolean

    True if this event could be represented as the given type.

  • Creates a new PollStartEvent from question, answers, and metadata.

    Parameters

    • question: string

      The question to ask.

    • answers: string[]

      The answers. Should be unique within each other.

    • kind: string | KnownPollKind

      The kind of poll.

    • maxSelections: number = 1

      The maximum number of selections. Must be 1 or higher.

    Returns PollStartEvent

    The representative poll start event.