Poll

class pyrogram.raw.types.Poll

Poll

Constructor of Poll.

Details:
  • Layer: 223

  • ID: 58747131

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.

  • 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)

  • 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.

TL Schema

poll#58747131
id:long
flags:#
closed:flags.0?true
public_voters:flags.1?true
multiple_choice:flags.2?true
quiz:flags.3?true
question:TextWithEntities
answers:Vector<PollAnswer>
close_period:flags.4?int
close_date:flags.5?int

= Poll

Parameter Tree

Poll
├── idlong
├── closedtrue (optional)
├── public_voterstrue (optional)
├── multiple_choicetrue (optional)
├── quiztrue (optional)
├── questionTextWithEntities
│ └── TextWithEntities
│ ├── textstring
│ └── entitiesVector < MessageEntity >
│ ├── MessageEntityUnknown
│ │ ├── offsetint
│ │ └── lengthint
│ ├── MessageEntityMention
│ │ ├── offsetint
│ │ └── lengthint
│ ├── MessageEntityHashtag
│ │ ├── offsetint
│ │ └── lengthint
│ │ ├── offsetint
│ │ └── lengthint
│ ├── MessageEntityUrl
│ │ ├── offsetint
│ │ └── lengthint
│ ├── MessageEntityEmail
│ │ ├── offsetint
│ │ └── lengthint
│ ├── MessageEntityBold
│ │ ├── offsetint
│ │ └── lengthint
│ ├── MessageEntityItalic
│ │ ├── offsetint
│ │ └── lengthint
│ ├── MessageEntityCode
│ │ ├── offsetint
│ │ └── lengthint
│ ├── MessageEntityPre
│ │ ├── offsetint
│ │ ├── lengthint
│ │ └── languagestring
│ ├── MessageEntityTextUrl
│ │ ├── offsetint
│ │ ├── lengthint
│ │ └── urlstring
│ │ ├── offsetint
│ │ ├── lengthint
│ │ └── user_idlong
│ │ ├── offsetint
│ │ ├── lengthint
│ │ └── user_idInputUser
│ │ ├── InputUserEmpty
│ │ ├── InputUserSelf
│ │ ├── InputUser
│ │ └── InputUserFromMessage
│ ├── MessageEntityPhone
│ │ ├── offsetint
│ │ └── lengthint
│ ├── MessageEntityCashtag
│ │ ├── offsetint
│ │ └── lengthint
│ │ ├── offsetint
│ │ └── lengthint
│ ├── MessageEntityStrike
│ │ ├── offsetint
│ │ └── lengthint
│ ├── MessageEntityBankCard
│ │ ├── offsetint
│ │ └── lengthint
│ ├── MessageEntitySpoiler
│ │ ├── offsetint
│ │ └── lengthint
│ │ ├── offsetint
│ │ ├── lengthint
│ │ └── document_idlong
│ │ ├── collapsedtrue (optional)
│ │ ├── offsetint
│ │ └── lengthint
│ ├── relativetrue (optional)
│ ├── short_timetrue (optional)
│ ├── long_timetrue (optional)
│ ├── short_datetrue (optional)
│ ├── long_datetrue (optional)
│ ├── day_of_weektrue (optional)
│ ├── offsetint
│ ├── lengthint
│ └── dateint
├── answersVector < PollAnswer >
│ └── PollAnswer
│ ├── textTextWithEntities
│ │ └── TextWithEntities
│ │ ├── textstring
│ │ └── entitiesVector < MessageEntity >
│ │ ├── MessageEntityUnknown
│ │ ├── MessageEntityMention
│ │ ├── MessageEntityHashtag
│ │ ├── MessageEntityBotCommand
│ │ ├── MessageEntityUrl
│ │ ├── MessageEntityEmail
│ │ ├── MessageEntityBold
│ │ ├── MessageEntityItalic
│ │ ├── MessageEntityCode
│ │ ├── MessageEntityPre
│ │ ├── MessageEntityTextUrl
│ │ ├── MessageEntityMentionName
│ │ ├── MessageEntityPhone
│ │ ├── MessageEntityCashtag
│ │ ├── MessageEntityUnderline
│ │ ├── MessageEntityStrike
│ │ ├── MessageEntityBankCard
│ │ ├── MessageEntitySpoiler
│ │ ├── MessageEntityCustomEmoji
│ │ ├── MessageEntityBlockquote
│ │ └── MessageEntityFormattedDate
│ └── optionbytes
├── close_periodint (optional)
└── close_dateint (optional)

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"
            )
        ],
)