Lingo.Type.Poll (Lingo v0.4.2)

Copy Markdown View Source

A message's poll. Build one to send with Lingo.Poll.build/3.

question and each answer's poll_media are maps with atom keys holding the text and an optional Lingo.Type.Emoji. results holds the vote counts, once Discord has them; they're final when is_finalized is true. layout_type is :default, the only layout so far.

Summary

Types

answer()

@type answer() :: %{answer_id: integer(), poll_media: media()}

answer_count()

@type answer_count() :: %{id: integer(), count: integer(), me_voted: boolean()}

media()

@type media() :: %{text: String.t() | nil, emoji: Lingo.Type.Emoji.t() | nil}

results()

@type results() :: %{is_finalized: boolean(), answer_counts: [answer_count()]}

t()

@type t() :: %Lingo.Type.Poll{
  allow_multiselect: boolean(),
  answers: [answer()],
  expiry: DateTime.t() | nil,
  layout_type: :default | integer(),
  question: media(),
  results: results() | nil
}