Skip to main content

ronami_core/payloads/
send_poll.rs

1//! Generated by `codegen_payloads`, do not edit by hand.
2
3use chrono::{DateTime, Utc};
4use serde::Serialize;
5
6use crate::types::{
7    BusinessConnectionId, EffectId, InputPollMedia, InputPollOption, Message, MessageEntity,
8    ParseMode, PollType, Recipient, ReplyMarkup, ReplyParameters, ThreadId,
9};
10
11impl_payload! {
12    /// Use this method to send a native poll. On success, the sent [`Message`] is returned.
13    ///
14    /// [`Message`]: crate::types::Message
15    #[derive(Debug, PartialEq, Clone, Serialize)]
16    pub SendPoll (SendPollSetters) => Message {
17        required {
18            /// Unique identifier for the target chat or username of the target channel (in the format `@channelusername`)
19            pub chat_id: Recipient [into],
20            /// Poll question, 1-300 characters
21            pub question: String [into],
22            /// A JSON-serialized list of 2-10 answer options
23            pub options: Vec<InputPollOption> [collect],
24        }
25        optional {
26            /// Unique identifier of the business connection on behalf of which the message will be sent
27            pub business_connection_id: BusinessConnectionId,
28            /// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
29            pub message_thread_id: ThreadId,
30            /// Mode for parsing entities in the question. See [formatting options] for more details. Currently, only custom emoji entities are allowed
31            ///
32            /// [formatting options]: https://core.telegram.org/bots/api#formatting-options
33            pub question_parse_mode: ParseMode,
34            /// A JSON-serialized list of special entities that appear in the poll question. It can be specified instead of _question\_parse\_mode_
35            pub question_entities: Vec<MessageEntity> [collect],
36            /// True, if the poll needs to be anonymous, defaults to True
37            pub is_anonymous: bool,
38            /// Poll type, “quiz” or “regular”, defaults to “regular”
39            #[serde(rename = "type")]
40            pub type_: PollType,
41            /// True, if the poll allows multiple answers, ignored for polls in quiz mode, defaults to False
42            pub allows_multiple_answers: bool,
43            /// True, if the poll allows to change the chosen answer options, defaults to False
44            pub allows_revoting: bool,
45            /// Pass True, if the options should be shuffled, defaults to False
46            pub shuffle_options: bool,
47            /// Pass True, if other users should be allowed to add options to the poll, defaults to False
48            pub allow_adding_options: bool,
49            /// Pass True, if the poll results should be hidden until the poll is closed, defaults to False
50            pub hide_results_until_closes: bool,
51            /// Pass True, if the poll is not available for users, that are not in the chat; for supergroups only
52            pub members_only: bool,
53            /// A JSON-serialized list of countries in the [ISO 3166-1 alpha-2] format for which the poll can be voted in by regular users
54            pub country_codes: Vec<String> [collect],
55            /// 0-based identifiers of the correct answer options, required for polls in quiz mode
56            pub correct_option_ids: Vec<u8> [collect],
57            /// 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 with at most 2 line feeds after entities parsing
58            pub explanation: String [into],
59            /// Mode for parsing entities in the message text. See [formatting options] for more details.
60            ///
61            /// [formatting options]: https://core.telegram.org/bots/api#formatting-options
62            pub explanation_parse_mode: ParseMode,
63            /// List of special entities that appear in the poll explanation, which can be specified instead of _parse\_mode_
64            pub explanation_entities: Vec<MessageEntity> [collect],
65            /// A JSON-serialized object for the media in the explanation to be sent
66            pub explanation_media: InputPollMedia,
67            /// Amount of time in seconds the poll will be active after creation, 5-2628000. Can't be used together with close_date.
68            pub open_period: u32,
69            /// Point in time (Unix timestamp) when the poll will be automatically closed. Must be at least 5 and no more than 2628000 seconds in the future. Can't be used together with open_period.
70            #[serde(with = "crate::types::serde_opt_date_from_unix_timestamp")]
71            pub close_date: DateTime<Utc> [into],
72            /// Pass True, if the poll needs to be immediately closed. This can be useful for poll preview.
73            pub is_closed: bool,
74            /// Description of the poll, 0-1024 characters after entities parsing
75            pub description: String [into],
76            /// Mode for parsing entities in the poll description. See [formatting options] for more details.
77            ///
78            /// [formatting options]: https://core.telegram.org/bots/api#formatting-options
79            pub description_parse_mode: ParseMode,
80            /// List of special entities that appear in the poll description, which can be specified instead of _description\_parse\_mode_
81            pub description_entities: Vec<MessageEntity> [collect],
82            /// A JSON-serialized object for the media added to the poll description
83            pub media: InputPollMedia,
84            /// Sends the message [silently]. Users will receive a notification with no sound.
85            ///
86            /// [silently]: https://telegram.org/blog/channels-2-0#silent-messages
87            pub disable_notification: bool,
88            /// Protects the contents of sent messages from forwarding and saving
89            pub protect_content: bool,
90            /// Pass `true` to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance
91            pub allow_paid_broadcast: bool,
92            /// Unique identifier of the message effect to be added to the message; for private chats only
93            pub message_effect_id: EffectId,
94            /// Description of the message to reply to
95            pub reply_parameters: ReplyParameters,
96            /// Additional interface options. A JSON-serialized object for an [inline keyboard], [custom reply keyboard], instructions to remove a reply keyboard or to force a reply from the user. Not supported for messages sent on behalf of a business account.
97            ///
98            /// [inline keyboard]: https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating
99            /// [custom reply keyboard]: https://core.telegram.org/bots#keyboards
100            pub reply_markup: ReplyMarkup [into],
101        }
102    }
103}