Lingo.Poll (Lingo v0.4.2)

Copy Markdown View Source

Builds message polls.

Lingo.Api.Message.create(channel_id, %{
  poll: Lingo.Poll.build("Pizza or pasta?", ["Pizza", {"Pasta", "🍝"}], duration: 48)
})

A sent poll comes back in Lingo.Type.Message's poll; end it early with Lingo.Api.Poll.expire/2.

Summary

Functions

Builds a poll from its question and up to 10 answers. An answer is its text, or {text, emoji} with a unicode emoji or a custom one (a Lingo.Type.Emoji, or a map with its :id).

Functions

build(question, answers, opts \\ [])

@spec build(String.t(), [String.t() | {String.t(), String.t() | map()}], keyword()) ::
  map()

Builds a poll from its question and up to 10 answers. An answer is its text, or {text, emoji} with a unicode emoji or a custom one (a Lingo.Type.Emoji, or a map with its :id).

Options: :duration (hours open, up to 768; Discord's default is 24) and :multiselect (whether users may pick several answers).