added fields to Poll

This commit is contained in:
p0lunin 2020-02-05 17:02:10 +02:00
parent 4d8b2d0473
commit 375f09df18
3 changed files with 20 additions and 3 deletions

View file

@ -9,8 +9,7 @@ use crate::{
};
use crate::types::PollType;
/// Use this method to send a native poll. A native poll can't be sent to a
/// private chat.
/// Use this method to send a native poll.
///
/// [The official docs](https://core.telegram.org/bots/api#sendpoll).
#[serde_with_macros::skip_serializing_none]

View file

@ -1,4 +1,5 @@
use serde::{Deserialize, Serialize};
use crate::types::PollType;
/// This object contains information about a poll.
///
@ -16,6 +17,23 @@ pub struct Poll {
/// `true`, if the poll is closed.
pub is_closed: bool,
/// Total number of users that voted in the poll
pub total_voter_count: i32,
/// True, if the poll is anonymous
pub is_anonymous: bool,
/// Poll type, currently can be “regular” or “quiz”
pub poll_type: PollType,
/// True, if the poll allows multiple answers
pub allows_multiple_answers: bool,
/// 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.
pub correct_option_id: Option<i32>
}
/// This object contains information about one answer option in a poll.

View file

@ -1,6 +1,6 @@
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "lowercase")]
pub enum PollType {
Quiz,