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
-
Poll( question: PollQuestion, answers: List(PollAnswer), duration: option.Option(Int), allow_multiselect: option.Option(Bool), layout_type: option.Option(Int), )Arguments
- answers
-
Up to 10 answers.
- duration
-
Duration in hours. Up to 768 hours == 32 days.
Learn more: Partial Emoji Resource - Documentation - Discord > Emoji Object
pub type PollEmoji {
PollEmoji(
id: option.Option(snowflake.Snowflake),
name: option.Option(String),
)
}
Constructors
-
PollEmoji( id: option.Option(snowflake.Snowflake), name: option.Option(String), )Arguments
- id
-
Specify if custom emoji.
- name
-
Specify if default emoji.
Example 1:
option.Option("🔥")Example 2:
option.Option("\u{1f525}")
pub type PollMedia {
PollMedia(
text: option.Option(String),
emoji: option.Option(PollEmoji),
)
}
Constructors
-
PollMedia( text: option.Option(String), emoji: option.Option(PollEmoji), )Arguments
- text
-
If specified, at least 1 character and up to 55 characters for any answer.
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 with_poll_emoji_id(
emoji: PollEmoji,
id: snowflake.Snowflake,
) -> PollEmoji