Skip to main content

messages.sendVote

Vote in a poll Starting from layer 159, the vote will be sent from the peer specified using messages saveDefaultSendAs.

func (c *Client) MessagesSendVote(ctx context.Context, request *MessagesSendVoteRequest) (UpdatesClass, error)

Calling this method

client.Run(ctx, func(ctx context.Context) error {
api := client.API()

res, err := api.MessagesSendVote(ctx, &tg.MessagesSendVoteRequest{
// see Parameters
})
if err != nil {
return err
}
_ = res // UpdatesClass
return nil
})

Parameters

NameTypeRequiredDescription
PeerInputPeerClassyesThe chat where the poll was sent
MsgIDintyesThe message ID of the poll
Options[][]byteyesThe options that were chosen

Returns

UpdatesClass

Possible errors

CodeTypeDescription
400CHANNEL_INVALIDThe provided channel is invalid.
400CHANNEL_PRIVATEYou haven't joined this channel/supergroup.
400MESSAGE_ID_INVALIDThe provided message id is invalid.
400MESSAGE_POLL_CLOSEDPoll closed.
400MSG_ID_INVALIDInvalid message ID provided.
400OPTIONS_TOO_MUCHToo many options provided.
400OPTION_INVALIDInvalid option selected.
400PEER_ID_INVALIDThe provided peer id is invalid.
400REVOTE_NOT_ALLOWEDYou cannot change your vote.

References