AddPollAnswerRequest

Both users and bots may be able to use this request. See code examples.

---functions---
messages.addPollAnswer#19bc4b6d peer:InputPeer msg_id:int answer:PollAnswer = Updates

Returns

Updates

This type can be an instance of either:

UpdateShortUpdateShortChatMessage
UpdateShortMessageUpdateShortSentMessage
UpdatesUpdatesCombined
UpdatesTooLong

Parameters

peerInputPeerAnything entity-like will work if the library can find its Input version (e.g., usernames, Peer, User or Channel objects, etc.).
msg_idint
answerPollAnswer

Known RPC errors

This request can't cause any RPC error as far as we know.

Example

from telethon.sync import TelegramClient
from telethon import functions, types

with TelegramClient(name, api_id, api_hash) as client:
    result = client(functions.messages.AddPollAnswerRequest(
        peer='username',
        msg_id=42,
        answer=types.PollAnswer(
            text=types.TextWithEntities(
                text='some string here',
                entities=[types.MessageEntityUnknown(
                    offset=42,
                    length=42
                )]
            ),
            option=b'arbitrary\x7f data \xfa here',
            media=types.MessageMediaPhoto(
                spoiler=True,
                live_photo=True,
                photo=types.Photo(
                    id=-12398745604826,
                    access_hash=-12398745604826,
                    file_reference=b'arbitrary\x7f data \xfa here',
                    date=datetime.datetime(2018, 6, 25),
                    sizes=[types.PhotoSize(
                        type='some string here',
                        w=42,
                        h=42,
                        size=42
                    )],
                    dc_id=42,
                    has_stickers=True,
                    video_sizes=[types.VideoSize(
                        type='some string here',
                        w=42,
                        h=42,
                        size=42,
                        video_start_ts=7.13
                    )]
                ),
                ttl_seconds=42,
                video=types.Document(
                    id=-12398745604826,
                    access_hash=-12398745604826,
                    file_reference=b'arbitrary\x7f data \xfa here',
                    date=datetime.datetime(2018, 6, 25),
                    mime_type='some string here',
                    size=-12398745604826,
                    dc_id=42,
                    attributes=[types.DocumentAttributeImageSize(
                        w=42,
                        h=42
                    )],
                    thumbs=[types.PhotoSize(
                        type='some string here',
                        w=42,
                        h=42,
                        size=42
                    )],
                    video_thumbs=[types.VideoSize(
                        type='some string here',
                        w=42,
                        h=42,
                        size=42,
                        video_start_ts=7.13
                    )]
                )
            ),
            added_by=types.PeerUser(
                user_id=-12398745604826
            ),
            date=datetime.datetime(2018, 6, 25)
        )
    ))
    print(result.stringify())