kitazith/poll

Types

pub type Poll {
  Poll(
    question: PollQuestion,
    answers: List(PollAnswer),
    duration: option.Option(Int),
    allow_multiselect: option.Option(Bool),
    layout_type: option.Option(Int),
  )
}

Constructors

pub type PollAnswer {
  PollAnswer(poll_media: PollMedia)
}

Constructors

pub type PollEmoji {
  PollEmoji(
    id: option.Option(snowflake.Snowflake),
    name: option.Option(String),
  )
}

Constructors

pub type PollMedia {
  PollMedia(
    text: option.Option(String),
    emoji: option.Option(PollEmoji),
  )
}

Constructors

Learn more: Poll Resource - Documentation - Discord > Poll Media Object

Poll.question only supports text, while Poll.answers supports both text and emoji.

pub type PollQuestion {
  PollQuestion(text: String)
}

Constructors

  • PollQuestion(text: String)

    Arguments

    text

    At least 1 character and up to 300 characters.

Values

pub fn new(
  question question: PollQuestion,
  answers answers: List(PollAnswer),
) -> Poll
pub fn new_poll_emoji() -> PollEmoji
pub fn new_poll_media() -> PollMedia
pub fn to_json(p: Poll) -> json.Json
pub fn with_allow_multiselect(
  poll: Poll,
  allow_multiselect: Bool,
) -> Poll
pub fn with_duration(poll: Poll, hours duration: Int) -> Poll
pub fn with_layout_type(poll: Poll, layout_type: Int) -> Poll
pub fn with_poll_emoji_id(
  emoji: PollEmoji,
  id: snowflake.Snowflake,
) -> PollEmoji
pub fn with_poll_emoji_name(
  emoji: PollEmoji,
  name: String,
) -> PollEmoji
pub fn with_poll_media_emoji(
  media: PollMedia,
  emoji: PollEmoji,
) -> PollMedia
pub fn with_poll_media_text(
  media: PollMedia,
  text: String,
) -> PollMedia
Search Document