Class PollContext

Hierarchy

Constructors

Properties

_client: Evogram
_source: IPoll
client: Evogram = ...

Accessors

  • get explanation(): undefined | string
  • Gets the text that is shown when a user chooses an incorrect answer or taps on the lamp icon in a quiz-style poll, if specified.

    Returns undefined | string

  • get openPeriod(): undefined | number
  • Gets the amount of time in seconds the poll will be active after creation, if specified.

    Returns undefined | number

Methods

  • This method searches for a poll option with the given text among all the options in the poll.

    Type Parameters

    Parameters

    • text: string

      Parameter specifies the text to search for.

    Returns undefined | T

    The found poll option.

  • Returns the percentage of votes for the transmitted option

    Parameters

    • option: IPollOption

      Poll option from which to calculate the percentage

    Returns number

    Percentage of those who voted for option

  • Converts the source object to a context object of a given type.

    Example

    client.updates.on("message", message => {
    const user = message.user.toContext<CustomUserContext>();
    // Now user works correctly with your context
    })

    Type Parameters

    • TContext extends object

      Generic type parameter for the context object.

    Returns TContext

    The context object.

Generated using TypeDoc