Poll

class pyrogram.raw.types.Poll

Poll

Constructor of Poll.

Details:
  • Layer: 227

  • ID: 966E2DBF

Parameters:
  • id (int 64-bit) – ID of the poll

  • question (TextWithEntities) – The question of the poll (only Premium users can use custom emoji entities here).

  • answers (List of PollAnswer) – The possible answers (2-poll_answers_max), vote using messages.sendVote.

  • hash (int 64-bit) – N/A

  • closed (bool, optional) – Whether the poll is closed and doesn’t accept any more answers

  • public_voters (bool, optional) – Whether cast votes are publicly visible to all users (non-anonymous poll)

  • multiple_choice (bool, optional) – Whether multiple options can be chosen as answer

  • quiz (bool, optional) – Whether this is a quiz (with wrong and correct answers, results shown in the return type)

  • open_answers (bool, optional) – N/A

  • revoting_disabled (bool, optional) – N/A

  • shuffle_answers (bool, optional) – N/A

  • hide_results_until_close (bool, optional) – N/A

  • creator (bool, optional) – N/A

  • subscribers_only (bool, optional) – N/A

  • close_period (int 32-bit, optional) – Amount of time in seconds the poll will be active after creation, 5-600. Can’t be used together with close_date.

  • close_date (int 32-bit, optional) – Point in time (Unix timestamp) when the poll will be automatically closed. Must be at least 5 and no more than 600 seconds in the future; can’t be used together with close_period.

  • countries_iso2 (List of str, optional) – N/A

TL Schema

poll#966e2dbf
id:long
flags:#
closed:flags.0?true
public_voters:flags.1?true
multiple_choice:flags.2?true
quiz:flags.3?true
open_answers:flags.6?true
revoting_disabled:flags.7?true
shuffle_answers:flags.8?true
hide_results_until_close:flags.9?true
creator:flags.10?true
subscribers_only:flags.11?true
question:TextWithEntities
answers:Vector<PollAnswer>
close_period:flags.4?int
close_date:flags.5?int
countries_iso2:flags.12?Vector<string>
hash:long

= Poll

Parameter Tree

Poll
├── id → long
├── closed → true (optional)
├── public_voters → true (optional)
├── multiple_choice → true (optional)
├── quiz → true (optional)
├── open_answers → true (optional)
├── revoting_disabled → true (optional)
├── shuffle_answers → true (optional)
├── hide_results_until_close → true (optional)
├── creator → true (optional)
├── subscribers_only → true (optional)
├── question → TextWithEntities
│ └── TextWithEntities
│ ├── text → string
│ └── entities → Vector < MessageEntity >
│ ├── MessageEntityUnknown
│ │ ├── offset → int
│ │ └── length → int
│ ├── MessageEntityMention
│ │ ├── offset → int
│ │ └── length → int
│ ├── MessageEntityHashtag
│ │ ├── offset → int
│ │ └── length → int
│ │ ├── offset → int
│ │ └── length → int
│ ├── MessageEntityUrl
│ │ ├── offset → int
│ │ └── length → int
│ ├── MessageEntityEmail
│ │ ├── offset → int
│ │ └── length → int
│ ├── MessageEntityBold
│ │ ├── offset → int
│ │ └── length → int
│ ├── MessageEntityItalic
│ │ ├── offset → int
│ │ └── length → int
│ ├── MessageEntityCode
│ │ ├── offset → int
│ │ └── length → int
│ ├── MessageEntityPre
│ │ ├── offset → int
│ │ ├── length → int
│ │ └── language → string
│ ├── MessageEntityTextUrl
│ │ ├── offset → int
│ │ ├── length → int
│ │ └── url → string
│ │ ├── offset → int
│ │ ├── length → int
│ │ └── user_id → long
│ │ ├── offset → int
│ │ ├── length → int
│ │ └── user_id → InputUser
│ │ ├── InputUserEmpty
│ │ ├── InputUserSelf
│ │ ├── InputUser
│ │ └── InputUserFromMessage
│ ├── MessageEntityPhone
│ │ ├── offset → int
│ │ └── length → int
│ ├── MessageEntityCashtag
│ │ ├── offset → int
│ │ └── length → int
│ │ ├── offset → int
│ │ └── length → int
│ ├── MessageEntityStrike
│ │ ├── offset → int
│ │ └── length → int
│ ├── MessageEntityBankCard
│ │ ├── offset → int
│ │ └── length → int
│ ├── MessageEntitySpoiler
│ │ ├── offset → int
│ │ └── length → int
│ │ ├── offset → int
│ │ ├── length → int
│ │ └── document_id → long
│ │ ├── collapsed → true (optional)
│ │ ├── offset → int
│ │ └── length → int
│ │ ├── relative → true (optional)
│ │ ├── short_time → true (optional)
│ │ ├── long_time → true (optional)
│ │ ├── short_date → true (optional)
│ │ ├── long_date → true (optional)
│ │ ├── day_of_week → true (optional)
│ │ ├── offset → int
│ │ ├── length → int
│ │ └── date → int
│ │ ├── offset → int
│ │ └── length → int
│ │ ├── offset → int
│ │ ├── length → int
│ │ └── old_text → string
│ ├── offset → int
│ └── length → int
├── answers → Vector < PollAnswer >
│ ├── PollAnswer
│ │ ├── text → TextWithEntities
│ │ │ └── TextWithEntities
│ │ │ ├── text → string
│ │ │ └── entities → Vector < MessageEntity >
│ │ │ ├── MessageEntityUnknown
│ │ │ ├── MessageEntityMention
│ │ │ ├── MessageEntityHashtag
│ │ │ ├── MessageEntityBotCommand
│ │ │ ├── MessageEntityUrl
│ │ │ ├── MessageEntityEmail
│ │ │ ├── MessageEntityBold
│ │ │ ├── MessageEntityItalic
│ │ │ ├── MessageEntityCode
│ │ │ ├── MessageEntityPre
│ │ │ ├── MessageEntityTextUrl
│ │ │ ├── MessageEntityMentionName
│ │ │ ├── InputMessageEntityMentionName
│ │ │ ├── MessageEntityPhone
│ │ │ ├── MessageEntityCashtag
│ │ │ ├── MessageEntityUnderline
│ │ │ ├── MessageEntityStrike
│ │ │ ├── MessageEntityBankCard
│ │ │ ├── MessageEntitySpoiler
│ │ │ ├── MessageEntityCustomEmoji
│ │ │ ├── MessageEntityBlockquote
│ │ │ ├── MessageEntityFormattedDate
│ │ │ ├── MessageEntityDiffInsert
│ │ │ ├── MessageEntityDiffReplace
│ │ │ └── MessageEntityDiffDelete
│ │ ├── option → bytes
│ │ ├── media → MessageMedia (optional)
│ │ │ ├── MessageMediaEmpty
│ │ │ ├── MessageMediaPhoto
│ │ │ │ ├── spoiler → true (optional)
│ │ │ │ ├── live_photo → true (optional)
│ │ │ │ ├── photo → Photo (optional)
│ │ │ │ │ ├── PhotoEmpty
│ │ │ │ │ └── Photo
│ │ │ │ ├── ttl_seconds → int (optional)
│ │ │ │ └── video → Document (optional)
│ │ │ │ ├── DocumentEmpty
│ │ │ │ └── Document
│ │ │ ├── MessageMediaGeo
│ │ │ │ └── geo → GeoPoint
│ │ │ │ ├── GeoPointEmpty
│ │ │ │ └── GeoPoint
│ │ │ ├── MessageMediaContact
│ │ │ │ ├── phone_number → string
│ │ │ │ ├── first_name → string
│ │ │ │ ├── last_name → string
│ │ │ │ ├── vcard → string
│ │ │ │ └── user_id → long
│ │ │ ├── MessageMediaUnsupported
│ │ │ ├── MessageMediaDocument
│ │ │ │ ├── nopremium → true (optional)
│ │ │ │ ├── spoiler → true (optional)
│ │ │ │ ├── video → true (optional)
│ │ │ │ ├── round → true (optional)
│ │ │ │ ├── voice → true (optional)
│ │ │ │ ├── document → Document (optional)
│ │ │ │ │ ├── DocumentEmpty
│ │ │ │ │ └── Document
│ │ │ │ ├── alt_documents → Vector < Document > (optional)
│ │ │ │ │ ├── DocumentEmpty
│ │ │ │ │ └── Document
│ │ │ │ ├── video_cover → Photo (optional)
│ │ │ │ │ ├── PhotoEmpty
│ │ │ │ │ └── Photo
│ │ │ │ ├── video_timestamp → int (optional)
│ │ │ │ └── ttl_seconds → int (optional)
│ │ │ ├── MessageMediaWebPage
│ │ │ │ ├── force_large_media → true (optional)
│ │ │ │ ├── force_small_media → true (optional)
│ │ │ │ ├── manual → true (optional)
│ │ │ │ ├── safe → true (optional)
│ │ │ │ └── webpage → WebPage
│ │ │ │ ├── WebPageEmpty
│ │ │ │ ├── WebPagePending
│ │ │ │ ├── WebPage
│ │ │ │ └── WebPageNotModified
│ │ │ ├── MessageMediaVenue
│ │ │ │ ├── geo → GeoPoint
│ │ │ │ │ ├── GeoPointEmpty
│ │ │ │ │ └── GeoPoint
│ │ │ │ ├── title → string
│ │ │ │ ├── address → string
│ │ │ │ ├── provider → string
│ │ │ │ ├── venue_id → string
│ │ │ │ └── venue_type → string
│ │ │ ├── MessageMediaGame
│ │ │ │ └── game → Game
│ │ │ │ └── Game
│ │ │ ├── MessageMediaInvoice
│ │ │ │ ├── shipping_address_requested → true (optional)
│ │ │ │ ├── test → true (optional)
│ │ │ │ ├── title → string
│ │ │ │ ├── description → string
│ │ │ │ ├── photo → WebDocument (optional)
│ │ │ │ │ ├── WebDocument
│ │ │ │ │ └── WebDocumentNoProxy
│ │ │ │ ├── receipt_msg_id → int (optional)
│ │ │ │ ├── currency → string
│ │ │ │ ├── total_amount → long
│ │ │ │ ├── start_param → string
│ │ │ │ └── extended_media → MessageExtendedMedia (optional)
│ │ │ │ ├── MessageExtendedMediaPreview
│ │ │ │ └── MessageExtendedMedia
│ │ │ ├── MessageMediaGeoLive
│ │ │ │ ├── geo → GeoPoint
│ │ │ │ │ ├── GeoPointEmpty
│ │ │ │ │ └── GeoPoint
│ │ │ │ ├── heading → int (optional)
│ │ │ │ ├── period → int
│ │ │ │ └── proximity_notification_radius → int (optional)
│ │ │ ├── MessageMediaPoll
│ │ │ │ ├── poll → Poll
│ │ │ │ │ └── Poll
│ │ │ │ ├── results → PollResults
│ │ │ │ │ └── PollResults
│ │ │ │ └── attached_media → MessageMedia (optional)
│ │ │ │ ├── MessageMediaEmpty
│ │ │ │ ├── MessageMediaPhoto
│ │ │ │ ├── MessageMediaGeo
│ │ │ │ ├── MessageMediaContact
│ │ │ │ ├── MessageMediaUnsupported
│ │ │ │ ├── MessageMediaDocument
│ │ │ │ ├── MessageMediaWebPage
│ │ │ │ ├── MessageMediaVenue
│ │ │ │ ├── MessageMediaGame
│ │ │ │ ├── MessageMediaInvoice
│ │ │ │ ├── MessageMediaGeoLive
│ │ │ │ ├── MessageMediaPoll
│ │ │ │ ├── MessageMediaDice
│ │ │ │ ├── MessageMediaStory
│ │ │ │ ├── MessageMediaGiveaway
│ │ │ │ ├── MessageMediaGiveawayResults
│ │ │ │ ├── MessageMediaPaidMedia
│ │ │ │ ├── MessageMediaToDo
│ │ │ │ └── MessageMediaVideoStream
│ │ │ ├── MessageMediaDice
│ │ │ │ ├── value → int
│ │ │ │ ├── emoticon → string
│ │ │ │ └── game_outcome → messages.EmojiGameOutcome (optional)
│ │ │ │ └── messages.EmojiGameOutcome
│ │ │ ├── MessageMediaStory
│ │ │ │ ├── via_mention → true (optional)
│ │ │ │ ├── peer → Peer
│ │ │ │ │ ├── PeerUser
│ │ │ │ │ ├── PeerChat
│ │ │ │ │ └── PeerChannel
│ │ │ │ ├── id → int
│ │ │ │ └── story → StoryItem (optional)
│ │ │ │ ├── StoryItemDeleted
│ │ │ │ ├── StoryItemSkipped
│ │ │ │ └── StoryItem
│ │ │ ├── MessageMediaGiveaway
│ │ │ │ ├── only_new_subscribers → true (optional)
│ │ │ │ ├── winners_are_visible → true (optional)
│ │ │ │ ├── channels → Vector < long >
│ │ │ │ ├── countries_iso2 → Vector < string > (optional)
│ │ │ │ ├── prize_description → string (optional)
│ │ │ │ ├── quantity → int
│ │ │ │ ├── months → int (optional)
│ │ │ │ ├── stars → long (optional)
│ │ │ │ └── until_date → int
│ │ │ ├── MessageMediaGiveawayResults
│ │ │ │ ├── only_new_subscribers → true (optional)
│ │ │ │ ├── refunded → true (optional)
│ │ │ │ ├── channel_id → long
│ │ │ │ ├── additional_peers_count → int (optional)
│ │ │ │ ├── launch_msg_id → int
│ │ │ │ ├── winners_count → int
│ │ │ │ ├── unclaimed_count → int
│ │ │ │ ├── winners → Vector < long >
│ │ │ │ ├── months → int (optional)
│ │ │ │ ├── stars → long (optional)
│ │ │ │ ├── prize_description → string (optional)
│ │ │ │ └── until_date → int
│ │ │ ├── MessageMediaPaidMedia
│ │ │ │ ├── stars_amount → long
│ │ │ │ └── extended_media → Vector < MessageExtendedMedia >
│ │ │ │ ├── MessageExtendedMediaPreview
│ │ │ │ └── MessageExtendedMedia
│ │ │ ├── MessageMediaToDo
│ │ │ │ ├── todo → TodoList
│ │ │ │ │ └── TodoList
│ │ │ │ └── completions → Vector < TodoCompletion > (optional)
│ │ │ │ └── TodoCompletion
│ │ │ └── MessageMediaVideoStream
│ │ │ ├── rtmp_stream → true (optional)
│ │ │ └── call → InputGroupCall
│ │ │ ├── InputGroupCall
│ │ │ ├── InputGroupCallSlug
│ │ │ └── InputGroupCallInviteMessage
│ │ ├── added_by → Peer (optional)
│ │ │ ├── PeerUser
│ │ │ │ └── user_id → long
│ │ │ ├── PeerChat
│ │ │ │ └── chat_id → long
│ │ │ └── PeerChannel
│ │ │ └── channel_id → long
│ │ └── date → int (optional)
│ └── InputPollAnswer
│ ├── text → TextWithEntities
│ │ └── TextWithEntities
│ │ ├── text → string
│ │ └── entities → Vector < MessageEntity >
│ │ ├── MessageEntityUnknown
│ │ ├── MessageEntityMention
│ │ ├── MessageEntityHashtag
│ │ ├── MessageEntityBotCommand
│ │ ├── MessageEntityUrl
│ │ ├── MessageEntityEmail
│ │ ├── MessageEntityBold
│ │ ├── MessageEntityItalic
│ │ ├── MessageEntityCode
│ │ ├── MessageEntityPre
│ │ ├── MessageEntityTextUrl
│ │ ├── MessageEntityMentionName
│ │ ├── MessageEntityPhone
│ │ ├── MessageEntityCashtag
│ │ ├── MessageEntityUnderline
│ │ ├── MessageEntityStrike
│ │ ├── MessageEntityBankCard
│ │ ├── MessageEntitySpoiler
│ │ ├── MessageEntityCustomEmoji
│ │ ├── MessageEntityBlockquote
│ │ ├── MessageEntityFormattedDate
│ │ ├── MessageEntityDiffInsert
│ │ ├── MessageEntityDiffReplace
│ │ └── MessageEntityDiffDelete
│ └── media → InputMedia (optional)
│ ├── InputMediaEmpty
│ ├── InputMediaPhoto
│ ├── InputMediaGeoPoint
│ ├── InputMediaContact
│ ├── InputMediaDocument
│ ├── InputMediaVenue
│ ├── InputMediaGame
│ ├── InputMediaInvoice
│ ├── InputMediaGeoLive
│ ├── InputMediaPoll
│ ├── InputMediaDice
│ ├── InputMediaStory
│ ├── InputMediaWebPage
│ ├── InputMediaPaidMedia
│ ├── InputMediaTodo
│ └── InputMediaStakeDice
├── close_period → int (optional)
├── close_date → int (optional)
├── countries_iso2 → Vector < string > (optional)
└── hash → long

Example

Poll(
    id=0,
    question=TextWithEntities(
        text="Open",
        entities=[
                MessageEntityUnknown(
                    offset=0,
                    length=0
                )
            ]
    ),
    answers=[
            PollAnswer(
                text=TextWithEntities(
                    text="Open",
                    entities=[
                            MessageEntityUnknown(
                                offset=0,
                                length=0
                            )
                        ]
                ),
                option=b"data"
            )
        ],
    hash=0,
)