// 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{})// MessagesSendPaidReactionRequest represents TL type `messages.sendPaidReaction#58bbcb50`.// Sends one or more paid Telegram Star reactions »¹, transferring Telegram Stars »²// to a channel's balance.//// Links:// 1. https://core.telegram.org/api/reactions#paid-reactions// 2. https://core.telegram.org/api/stars//// See https://core.telegram.org/method/messages.sendPaidReaction for reference.typeMessagesSendPaidReactionRequeststruct {// Flags, see TL conditional fields¹ // // Links: // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fieldsFlagsbin.Fields// The channelPeerInputPeerClass// The message to react toMsgIDint// The number of stars¹ to send (each will increment the reaction counter by one). // // Links: // 1) https://core.telegram.org/api/starsCountint// Unique client message ID required to prevent message resending. Note: this argument // must be composed of a 64-bit integer where the lower 32 bits are random, and the // higher 32 bits are equal to the current unixtime, i.e. `uint64_t random_id = (time() // << 32). See here »¹ for more info on random ID deduplication and updateMessageID // mapping. // // Links: // 1) https://core.telegram.org/api/updates#updatemessageid-updatesRandomIDint64// Each post with star reactions has a leaderboard with the top senders, but users can // opt out of appearing there if they prefer more privacy. Not populating this field will // use the default reaction privacy, stored on the server and synced to clients using // updatePaidReactionPrivacy¹ (see here² for more info). // // Links: // 1) https://core.telegram.org/constructor/updatePaidReactionPrivacy // 2) https://core.telegram.org/api/reactions#paid-reaction-privacy // // Use SetPrivate and GetPrivate helpers.PrivatePaidReactionPrivacyClass}// MessagesSendPaidReactionRequestTypeID is TL type id of MessagesSendPaidReactionRequest.constMessagesSendPaidReactionRequestTypeID = 0x58bbcb50// Ensuring interfaces in compile-time for MessagesSendPaidReactionRequest.var ( _ bin.Encoder = &MessagesSendPaidReactionRequest{} _ bin.Decoder = &MessagesSendPaidReactionRequest{} _ bin.BareEncoder = &MessagesSendPaidReactionRequest{} _ bin.BareDecoder = &MessagesSendPaidReactionRequest{})func ( *MessagesSendPaidReactionRequest) () bool {if == nil {returntrue }if !(.Flags.Zero()) {returnfalse }if !(.Peer == nil) {returnfalse }if !(.MsgID == 0) {returnfalse }if !(.Count == 0) {returnfalse }if !(.RandomID == 0) {returnfalse }if !(.Private == nil) {returnfalse }returntrue}// String implements fmt.Stringer.func ( *MessagesSendPaidReactionRequest) () string {if == nil {return"MessagesSendPaidReactionRequest(nil)" }typeMessagesSendPaidReactionRequestreturnfmt.Sprintf("MessagesSendPaidReactionRequest%+v", (*))}// FillFrom fills MessagesSendPaidReactionRequest from given interface.func ( *MessagesSendPaidReactionRequest) ( interface { () ( InputPeerClass) () ( int) () ( int) () ( int64) () ( PaidReactionPrivacyClass, bool)}) { .Peer = .() .MsgID = .() .Count = .() .RandomID = .()if , := .(); { .Private = }}// TypeID returns type id in TL schema.//// See https://core.telegram.org/mtproto/TL-tl#remarks.func (*MessagesSendPaidReactionRequest) () uint32 {returnMessagesSendPaidReactionRequestTypeID}// TypeName returns name of type in TL schema.func (*MessagesSendPaidReactionRequest) () string {return"messages.sendPaidReaction"}// TypeInfo returns info about TL type.func ( *MessagesSendPaidReactionRequest) () tdp.Type { := tdp.Type{Name: "messages.sendPaidReaction",ID: MessagesSendPaidReactionRequestTypeID, }if == nil { .Null = truereturn } .Fields = []tdp.Field{ {Name: "Peer",SchemaName: "peer", }, {Name: "MsgID",SchemaName: "msg_id", }, {Name: "Count",SchemaName: "count", }, {Name: "RandomID",SchemaName: "random_id", }, {Name: "Private",SchemaName: "private",Null: !.Flags.Has(0), }, }return}// SetFlags sets flags for non-zero fields.func ( *MessagesSendPaidReactionRequest) () {if !(.Private == nil) { .Flags.Set(0) }}// Encode implements bin.Encoder.func ( *MessagesSendPaidReactionRequest) ( *bin.Buffer) error {if == nil {returnfmt.Errorf("can't encode messages.sendPaidReaction#58bbcb50 as nil") } .PutID(MessagesSendPaidReactionRequestTypeID)return .EncodeBare()}// EncodeBare implements bin.BareEncoder.func ( *MessagesSendPaidReactionRequest) ( *bin.Buffer) error {if == nil {returnfmt.Errorf("can't encode messages.sendPaidReaction#58bbcb50 as nil") } .SetFlags()if := .Flags.Encode(); != nil {returnfmt.Errorf("unable to encode messages.sendPaidReaction#58bbcb50: field flags: %w", ) }if .Peer == nil {returnfmt.Errorf("unable to encode messages.sendPaidReaction#58bbcb50: field peer is nil") }if := .Peer.Encode(); != nil {returnfmt.Errorf("unable to encode messages.sendPaidReaction#58bbcb50: field peer: %w", ) } .PutInt(.MsgID) .PutInt(.Count) .PutLong(.RandomID)if .Flags.Has(0) {if .Private == nil {returnfmt.Errorf("unable to encode messages.sendPaidReaction#58bbcb50: field private is nil") }if := .Private.Encode(); != nil {returnfmt.Errorf("unable to encode messages.sendPaidReaction#58bbcb50: field private: %w", ) } }returnnil}// Decode implements bin.Decoder.func ( *MessagesSendPaidReactionRequest) ( *bin.Buffer) error {if == nil {returnfmt.Errorf("can't decode messages.sendPaidReaction#58bbcb50 to nil") }if := .ConsumeID(MessagesSendPaidReactionRequestTypeID); != nil {returnfmt.Errorf("unable to decode messages.sendPaidReaction#58bbcb50: %w", ) }return .DecodeBare()}// DecodeBare implements bin.BareDecoder.func ( *MessagesSendPaidReactionRequest) ( *bin.Buffer) error {if == nil {returnfmt.Errorf("can't decode messages.sendPaidReaction#58bbcb50 to nil") } {if := .Flags.Decode(); != nil {returnfmt.Errorf("unable to decode messages.sendPaidReaction#58bbcb50: field flags: %w", ) } } { , := DecodeInputPeer()if != nil {returnfmt.Errorf("unable to decode messages.sendPaidReaction#58bbcb50: field peer: %w", ) } .Peer = } { , := .Int()if != nil {returnfmt.Errorf("unable to decode messages.sendPaidReaction#58bbcb50: field msg_id: %w", ) } .MsgID = } { , := .Int()if != nil {returnfmt.Errorf("unable to decode messages.sendPaidReaction#58bbcb50: field count: %w", ) } .Count = } { , := .Long()if != nil {returnfmt.Errorf("unable to decode messages.sendPaidReaction#58bbcb50: field random_id: %w", ) } .RandomID = }if .Flags.Has(0) { , := DecodePaidReactionPrivacy()if != nil {returnfmt.Errorf("unable to decode messages.sendPaidReaction#58bbcb50: field private: %w", ) } .Private = }returnnil}// GetPeer returns value of Peer field.func ( *MessagesSendPaidReactionRequest) () ( InputPeerClass) {if == nil {return }return .Peer}// GetMsgID returns value of MsgID field.func ( *MessagesSendPaidReactionRequest) () ( int) {if == nil {return }return .MsgID}// GetCount returns value of Count field.func ( *MessagesSendPaidReactionRequest) () ( int) {if == nil {return }return .Count}// GetRandomID returns value of RandomID field.func ( *MessagesSendPaidReactionRequest) () ( int64) {if == nil {return }return .RandomID}// SetPrivate sets value of Private conditional field.func ( *MessagesSendPaidReactionRequest) ( PaidReactionPrivacyClass) { .Flags.Set(0) .Private = }// GetPrivate returns value of Private conditional field and// boolean which is true if field was set.func ( *MessagesSendPaidReactionRequest) () ( PaidReactionPrivacyClass, bool) {if == nil {return }if !.Flags.Has(0) {return , false }return .Private, true}// MessagesSendPaidReaction invokes method messages.sendPaidReaction#58bbcb50 returning error if any.// Sends one or more paid Telegram Star reactions »¹, transferring Telegram Stars »²// to a channel's balance.//// Links:// 1. https://core.telegram.org/api/reactions#paid-reactions// 2. https://core.telegram.org/api/stars//// Possible errors://// 400 BALANCE_TOO_LOW: The transaction cannot be completed because the current Telegram Stars balance is too low.// 400 CHANNEL_INVALID: The provided channel is invalid.// 400 CHANNEL_PRIVATE: You haven't joined this channel/supergroup.// 403 CHAT_WRITE_FORBIDDEN: You can't write in this chat.// 400 MESSAGE_ID_INVALID: The provided message id is invalid.// 400 PEER_ID_INVALID: The provided peer id is invalid.// 400 RANDOM_ID_EMPTY: Random ID empty.// 400 RANDOM_ID_EXPIRED: The specified random_id was expired (most likely it didn't follow the required `uint64_t random_id = (time() << 32)// 400 REACTIONS_COUNT_INVALID: The specified number of reactions is invalid.// 400 SEND_AS_PEER_INVALID: You can't send messages as the specified peer.//// See https://core.telegram.org/method/messages.sendPaidReaction for reference.func ( *Client) ( context.Context, *MessagesSendPaidReactionRequest) (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.