Struct botapi::gen_types::PollBuilder
source · pub struct PollBuilder {Show 14 fields
pub id: String,
pub question: String,
pub question_entities: Option<Vec<MessageEntity>>,
pub options: Vec<PollOption>,
pub total_voter_count: i64,
pub is_closed: bool,
pub is_anonymous: bool,
pub tg_type: String,
pub allows_multiple_answers: bool,
pub correct_option_id: Option<i64>,
pub explanation: Option<String>,
pub explanation_entities: Option<Vec<MessageEntity>>,
pub open_period: Option<i64>,
pub close_date: Option<i64>,
}
Expand description
This object contains information about a poll.
Fields§
§id: String
Unique poll identifier
question: String
Poll question, 1-300 characters
question_entities: Option<Vec<MessageEntity>>
Optional. Special entities that appear in the question. Currently, only custom emoji entities are allowed in poll questions
options: Vec<PollOption>
List of poll options
total_voter_count: i64
Total number of users that voted in the poll
is_closed: bool
True, if the poll is closed
is_anonymous: bool
True, if the poll is anonymous
tg_type: String
Poll type, currently can be “regular” or “quiz”
allows_multiple_answers: bool
True, if the poll allows multiple answers
correct_option_id: Option<i64>
Optional. 0-based identifier of the correct answer option. Available only for polls in the quiz mode, which are closed, or was sent (not forwarded) by the bot or to the private chat with the bot.
explanation: Option<String>
Optional. Text that is shown when a user chooses an incorrect answer or taps on the lamp icon in a quiz-style poll, 0-200 characters
explanation_entities: Option<Vec<MessageEntity>>
Optional. Special entities like usernames, URLs, bot commands, etc. that appear in the explanation
open_period: Option<i64>
Optional. Amount of time in seconds the poll will be active after creation
close_date: Option<i64>
Optional. Point in time (Unix timestamp) when the poll will be automatically closed
Implementations§
source§impl PollBuilder
impl PollBuilder
pub fn new( id: String, question: String, options: Vec<PollOption>, total_voter_count: i64, is_closed: bool, is_anonymous: bool, allows_multiple_answers: bool, ) -> Self
sourcepub fn set_question(self, question: String) -> Self
pub fn set_question(self, question: String) -> Self
Poll question, 1-300 characters
sourcepub fn set_question_entities(
self,
question_entities: Vec<MessageEntity>,
) -> Self
pub fn set_question_entities( self, question_entities: Vec<MessageEntity>, ) -> Self
Optional. Special entities that appear in the question. Currently, only custom emoji entities are allowed in poll questions
sourcepub fn set_options(self, options: Vec<PollOption>) -> Self
pub fn set_options(self, options: Vec<PollOption>) -> Self
List of poll options
sourcepub fn set_total_voter_count(self, total_voter_count: i64) -> Self
pub fn set_total_voter_count(self, total_voter_count: i64) -> Self
Total number of users that voted in the poll
sourcepub fn set_is_closed(self, is_closed: bool) -> Self
pub fn set_is_closed(self, is_closed: bool) -> Self
True, if the poll is closed
sourcepub fn set_is_anonymous(self, is_anonymous: bool) -> Self
pub fn set_is_anonymous(self, is_anonymous: bool) -> Self
True, if the poll is anonymous
sourcepub fn set_allows_multiple_answers(self, allows_multiple_answers: bool) -> Self
pub fn set_allows_multiple_answers(self, allows_multiple_answers: bool) -> Self
True, if the poll allows multiple answers
sourcepub fn set_correct_option_id(self, correct_option_id: i64) -> Self
pub fn set_correct_option_id(self, correct_option_id: i64) -> Self
Optional. 0-based identifier of the correct answer option. Available only for polls in the quiz mode, which are closed, or was sent (not forwarded) by the bot or to the private chat with the bot.
sourcepub fn set_explanation(self, explanation: String) -> Self
pub fn set_explanation(self, explanation: String) -> Self
Optional. Text that is shown when a user chooses an incorrect answer or taps on the lamp icon in a quiz-style poll, 0-200 characters
sourcepub fn set_explanation_entities(
self,
explanation_entities: Vec<MessageEntity>,
) -> Self
pub fn set_explanation_entities( self, explanation_entities: Vec<MessageEntity>, ) -> Self
Optional. Special entities like usernames, URLs, bot commands, etc. that appear in the explanation
sourcepub fn set_open_period(self, open_period: i64) -> Self
pub fn set_open_period(self, open_period: i64) -> Self
Optional. Amount of time in seconds the poll will be active after creation
sourcepub fn set_close_date(self, close_date: i64) -> Self
pub fn set_close_date(self, close_date: i64) -> Self
Optional. Point in time (Unix timestamp) when the poll will be automatically closed
pub fn build(self) -> Poll
Trait Implementations§
source§impl Clone for PollBuilder
impl Clone for PollBuilder
source§fn clone(&self) -> PollBuilder
fn clone(&self) -> PollBuilder
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for PollBuilder
impl Debug for PollBuilder
source§impl Default for PollBuilder
impl Default for PollBuilder
source§fn default() -> PollBuilder
fn default() -> PollBuilder
source§impl<'de> Deserialize<'de> for PollBuilder
impl<'de> Deserialize<'de> for PollBuilder
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl Hash for PollBuilder
impl Hash for PollBuilder
source§impl Ord for PollBuilder
impl Ord for PollBuilder
source§fn cmp(&self, other: &PollBuilder) -> Ordering
fn cmp(&self, other: &PollBuilder) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq for PollBuilder
impl PartialEq for PollBuilder
source§fn eq(&self, other: &PollBuilder) -> bool
fn eq(&self, other: &PollBuilder) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for PollBuilder
impl PartialOrd for PollBuilder
source§fn partial_cmp(&self, other: &PollBuilder) -> Option<Ordering>
fn partial_cmp(&self, other: &PollBuilder) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl Serialize for PollBuilder
impl Serialize for PollBuilder
impl Eq for PollBuilder
impl StructuralPartialEq for PollBuilder
Auto Trait Implementations§
impl Freeze for PollBuilder
impl RefUnwindSafe for PollBuilder
impl Send for PollBuilder
impl Sync for PollBuilder
impl Unpin for PollBuilder
impl UnwindSafe for PollBuilder
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.