// Code generated by gotdgen, DO NOT EDIT.package tgimport ()// No-op definition for keeping imports.var ( _ = bin.Buffer{} _ = context.Background() _ = fmt.Stringer(nil) _ = strings.Builder{} _ = errors.Is _ = multierr.AppendInto _ = sort.Ints _ = tdp.Format _ = tgerr.Error{} _ = tdjson.Encoder{})// MessagesSendVoteRequest represents TL type `messages.sendVote#10ea6184`.// Vote in a poll¹// Starting from layer 159, the vote will be sent from the peer specified using messages// saveDefaultSendAs¹.// Before voting, clients should check that the user is actually allowed to vote: voting// is not possible if the poll is closed, if it is subscriber-only »¹ and the user is// not an eligible subscriber, or if it is country-restricted »² and the user's// phone_country_iso2 »³ is not in the poll's allowed country list. See vote// restrictions »⁴ for the full list of conditions.//// Links:// 1. https://core.telegram.org/constructor/poll// 2. https://core.telegram.org/method/messages.saveDefaultSendAs// 3. https://core.telegram.org/api/poll#subscriber-only-polls// 4. https://core.telegram.org/api/poll#country-restricted-polls// 5. https://core.telegram.org/api/config#phone-country-iso2// 6. https://core.telegram.org/api/poll#vote-restrictions//// See https://core.telegram.org/method/messages.sendVote for reference.typeMessagesSendVoteRequeststruct {// The chat where the poll was sentPeerInputPeerClass// The message ID of the pollMsgIDint// The options that were chosenOptions [][]byte}// MessagesSendVoteRequestTypeID is TL type id of MessagesSendVoteRequest.constMessagesSendVoteRequestTypeID = 0x10ea6184// Ensuring interfaces in compile-time for MessagesSendVoteRequest.var ( _ bin.Encoder = &MessagesSendVoteRequest{} _ bin.Decoder = &MessagesSendVoteRequest{} _ bin.BareEncoder = &MessagesSendVoteRequest{} _ bin.BareDecoder = &MessagesSendVoteRequest{})func ( *MessagesSendVoteRequest) () bool {if == nil {returntrue }if !(.Peer == nil) {returnfalse }if !(.MsgID == 0) {returnfalse }if !(.Options == nil) {returnfalse }returntrue}// String implements fmt.Stringer.func ( *MessagesSendVoteRequest) () string {if == nil {return"MessagesSendVoteRequest(nil)" }typeMessagesSendVoteRequestreturnfmt.Sprintf("MessagesSendVoteRequest%+v", (*))}// FillFrom fills MessagesSendVoteRequest from given interface.func ( *MessagesSendVoteRequest) ( interface { () ( InputPeerClass) () ( int) () ( [][]byte)}) { .Peer = .() .MsgID = .() .Options = .()}// TypeID returns type id in TL schema.//// See https://core.telegram.org/mtproto/TL-tl#remarks.func (*MessagesSendVoteRequest) () uint32 {returnMessagesSendVoteRequestTypeID}// TypeName returns name of type in TL schema.func (*MessagesSendVoteRequest) () string {return"messages.sendVote"}// TypeInfo returns info about TL type.func ( *MessagesSendVoteRequest) () tdp.Type { := tdp.Type{Name: "messages.sendVote",ID: MessagesSendVoteRequestTypeID, }if == nil { .Null = truereturn } .Fields = []tdp.Field{ {Name: "Peer",SchemaName: "peer", }, {Name: "MsgID",SchemaName: "msg_id", }, {Name: "Options",SchemaName: "options", }, }return}// Encode implements bin.Encoder.func ( *MessagesSendVoteRequest) ( *bin.Buffer) error {if == nil {returnfmt.Errorf("can't encode messages.sendVote#10ea6184 as nil") } .PutID(MessagesSendVoteRequestTypeID)return .EncodeBare()}// EncodeBare implements bin.BareEncoder.func ( *MessagesSendVoteRequest) ( *bin.Buffer) error {if == nil {returnfmt.Errorf("can't encode messages.sendVote#10ea6184 as nil") }if .Peer == nil {returnfmt.Errorf("unable to encode messages.sendVote#10ea6184: field peer is nil") }if := .Peer.Encode(); != nil {returnfmt.Errorf("unable to encode messages.sendVote#10ea6184: field peer: %w", ) } .PutInt(.MsgID) .PutVectorHeader(len(.Options))for , := range .Options { .PutBytes() }returnnil}// Decode implements bin.Decoder.func ( *MessagesSendVoteRequest) ( *bin.Buffer) error {if == nil {returnfmt.Errorf("can't decode messages.sendVote#10ea6184 to nil") }if := .ConsumeID(MessagesSendVoteRequestTypeID); != nil {returnfmt.Errorf("unable to decode messages.sendVote#10ea6184: %w", ) }return .DecodeBare()}// DecodeBare implements bin.BareDecoder.func ( *MessagesSendVoteRequest) ( *bin.Buffer) error {if == nil {returnfmt.Errorf("can't decode messages.sendVote#10ea6184 to nil") } { , := DecodeInputPeer()if != nil {returnfmt.Errorf("unable to decode messages.sendVote#10ea6184: field peer: %w", ) } .Peer = } { , := .Int()if != nil {returnfmt.Errorf("unable to decode messages.sendVote#10ea6184: field msg_id: %w", ) } .MsgID = } { , := .VectorHeader()if != nil {returnfmt.Errorf("unable to decode messages.sendVote#10ea6184: field options: %w", ) }if > 0 { .Options = make([][]byte, 0, %bin.PreallocateLimit) }for := 0; < ; ++ { , := .Bytes()if != nil {returnfmt.Errorf("unable to decode messages.sendVote#10ea6184: field options: %w", ) } .Options = append(.Options, ) } }returnnil}// GetPeer returns value of Peer field.func ( *MessagesSendVoteRequest) () ( InputPeerClass) {if == nil {return }return .Peer}// GetMsgID returns value of MsgID field.func ( *MessagesSendVoteRequest) () ( int) {if == nil {return }return .MsgID}// GetOptions returns value of Options field.func ( *MessagesSendVoteRequest) () ( [][]byte) {if == nil {return }return .Options}// MessagesSendVote invokes method messages.sendVote#10ea6184 returning error if any.// Vote in a poll¹// Starting from layer 159, the vote will be sent from the peer specified using messages// saveDefaultSendAs¹.// Before voting, clients should check that the user is actually allowed to vote: voting// is not possible if the poll is closed, if it is subscriber-only »¹ and the user is// not an eligible subscriber, or if it is country-restricted »² and the user's// phone_country_iso2 »³ is not in the poll's allowed country list. See vote// restrictions »⁴ for the full list of conditions.//// Links:// 1. https://core.telegram.org/constructor/poll// 2. https://core.telegram.org/method/messages.saveDefaultSendAs// 3. https://core.telegram.org/api/poll#subscriber-only-polls// 4. https://core.telegram.org/api/poll#country-restricted-polls// 5. https://core.telegram.org/api/config#phone-country-iso2// 6. https://core.telegram.org/api/poll#vote-restrictions//// Possible errors://// 400 CHANNEL_INVALID: The provided channel is invalid.// 400 CHANNEL_PRIVATE: You haven't joined this channel/supergroup.// 400 MESSAGE_ID_INVALID: The provided message id is invalid.// 400 MESSAGE_POLL_CLOSED: Poll closed.// 400 MSG_ID_INVALID: Invalid message ID provided.// 400 OPTIONS_TOO_MUCH: Too many options provided.// 400 OPTION_INVALID: Invalid option selected.// 400 PEER_ID_INVALID: The provided peer id is invalid.// 406 POLL_COUNTRY_RESTRICTED: Users from the current user's country cannot vote in this country-restricted poll ».// 406 POLL_MEMBER_RESTRICTED: Only channel subscribers can vote in this poll.// 400 REVOTE_NOT_ALLOWED: You cannot change your vote.//// See https://core.telegram.org/method/messages.sendVote for reference.func ( *Client) ( context.Context, *MessagesSendVoteRequest) (UpdatesClass, error) {varUpdatesBoxif := .rpc.Invoke(, , &); != nil {returnnil, }return .Updates, nil}
The pages are generated with Goldsv0.8.7. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds.