package tg
import (
"context"
"errors"
"fmt"
"sort"
"strings"
"go.uber.org/multierr"
"github.com/gotd/td/bin"
"github.com/gotd/td/tdjson"
"github.com/gotd/td/tdp"
"github.com/gotd/td/tgerr"
)
var (
_ = bin .Buffer {}
_ = context .Background ()
_ = fmt .Stringer (nil )
_ = strings .Builder {}
_ = errors .Is
_ = multierr .AppendInto
_ = sort .Ints
_ = tdp .Format
_ = tgerr .Error {}
_ = tdjson .Encoder {}
)
type MessagesSendInlineBotResultRequest struct {
Flags bin .Fields
Silent bool
Background bool
ClearDraft bool
HideVia bool
Peer InputPeerClass
ReplyTo InputReplyToClass
RandomID int64
QueryID int64
ID string
ScheduleDate int
SendAs InputPeerClass
}
const MessagesSendInlineBotResultRequestTypeID = 0xf7bc68ba
var (
_ bin .Encoder = &MessagesSendInlineBotResultRequest {}
_ bin .Decoder = &MessagesSendInlineBotResultRequest {}
_ bin .BareEncoder = &MessagesSendInlineBotResultRequest {}
_ bin .BareDecoder = &MessagesSendInlineBotResultRequest {}
)
func (s *MessagesSendInlineBotResultRequest ) Zero () bool {
if s == nil {
return true
}
if !(s .Flags .Zero ()) {
return false
}
if !(s .Silent == false ) {
return false
}
if !(s .Background == false ) {
return false
}
if !(s .ClearDraft == false ) {
return false
}
if !(s .HideVia == false ) {
return false
}
if !(s .Peer == nil ) {
return false
}
if !(s .ReplyTo == nil ) {
return false
}
if !(s .RandomID == 0 ) {
return false
}
if !(s .QueryID == 0 ) {
return false
}
if !(s .ID == "" ) {
return false
}
if !(s .ScheduleDate == 0 ) {
return false
}
if !(s .SendAs == nil ) {
return false
}
return true
}
func (s *MessagesSendInlineBotResultRequest ) String () string {
if s == nil {
return "MessagesSendInlineBotResultRequest(nil)"
}
type Alias MessagesSendInlineBotResultRequest
return fmt .Sprintf ("MessagesSendInlineBotResultRequest%+v" , Alias (*s ))
}
func (s *MessagesSendInlineBotResultRequest ) FillFrom (from interface {
GetSilent () (value bool )
GetBackground () (value bool )
GetClearDraft () (value bool )
GetHideVia () (value bool )
GetPeer () (value InputPeerClass )
GetReplyTo () (value InputReplyToClass , ok bool )
GetRandomID () (value int64 )
GetQueryID () (value int64 )
GetID () (value string )
GetScheduleDate () (value int , ok bool )
GetSendAs () (value InputPeerClass , ok bool )
}) {
s .Silent = from .GetSilent ()
s .Background = from .GetBackground ()
s .ClearDraft = from .GetClearDraft ()
s .HideVia = from .GetHideVia ()
s .Peer = from .GetPeer ()
if val , ok := from .GetReplyTo (); ok {
s .ReplyTo = val
}
s .RandomID = from .GetRandomID ()
s .QueryID = from .GetQueryID ()
s .ID = from .GetID ()
if val , ok := from .GetScheduleDate (); ok {
s .ScheduleDate = val
}
if val , ok := from .GetSendAs (); ok {
s .SendAs = val
}
}
func (*MessagesSendInlineBotResultRequest ) TypeID () uint32 {
return MessagesSendInlineBotResultRequestTypeID
}
func (*MessagesSendInlineBotResultRequest ) TypeName () string {
return "messages.sendInlineBotResult"
}
func (s *MessagesSendInlineBotResultRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.sendInlineBotResult" ,
ID : MessagesSendInlineBotResultRequestTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Silent" ,
SchemaName : "silent" ,
Null : !s .Flags .Has (5 ),
},
{
Name : "Background" ,
SchemaName : "background" ,
Null : !s .Flags .Has (6 ),
},
{
Name : "ClearDraft" ,
SchemaName : "clear_draft" ,
Null : !s .Flags .Has (7 ),
},
{
Name : "HideVia" ,
SchemaName : "hide_via" ,
Null : !s .Flags .Has (11 ),
},
{
Name : "Peer" ,
SchemaName : "peer" ,
},
{
Name : "ReplyTo" ,
SchemaName : "reply_to" ,
Null : !s .Flags .Has (0 ),
},
{
Name : "RandomID" ,
SchemaName : "random_id" ,
},
{
Name : "QueryID" ,
SchemaName : "query_id" ,
},
{
Name : "ID" ,
SchemaName : "id" ,
},
{
Name : "ScheduleDate" ,
SchemaName : "schedule_date" ,
Null : !s .Flags .Has (10 ),
},
{
Name : "SendAs" ,
SchemaName : "send_as" ,
Null : !s .Flags .Has (13 ),
},
}
return typ
}
func (s *MessagesSendInlineBotResultRequest ) SetFlags () {
if !(s .Silent == false ) {
s .Flags .Set (5 )
}
if !(s .Background == false ) {
s .Flags .Set (6 )
}
if !(s .ClearDraft == false ) {
s .Flags .Set (7 )
}
if !(s .HideVia == false ) {
s .Flags .Set (11 )
}
if !(s .ReplyTo == nil ) {
s .Flags .Set (0 )
}
if !(s .ScheduleDate == 0 ) {
s .Flags .Set (10 )
}
if !(s .SendAs == nil ) {
s .Flags .Set (13 )
}
}
func (s *MessagesSendInlineBotResultRequest ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode messages.sendInlineBotResult#f7bc68ba as nil" )
}
b .PutID (MessagesSendInlineBotResultRequestTypeID )
return s .EncodeBare (b )
}
func (s *MessagesSendInlineBotResultRequest ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode messages.sendInlineBotResult#f7bc68ba as nil" )
}
s .SetFlags ()
if err := s .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.sendInlineBotResult#f7bc68ba: field flags: %w" , err )
}
if s .Peer == nil {
return fmt .Errorf ("unable to encode messages.sendInlineBotResult#f7bc68ba: field peer is nil" )
}
if err := s .Peer .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.sendInlineBotResult#f7bc68ba: field peer: %w" , err )
}
if s .Flags .Has (0 ) {
if s .ReplyTo == nil {
return fmt .Errorf ("unable to encode messages.sendInlineBotResult#f7bc68ba: field reply_to is nil" )
}
if err := s .ReplyTo .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.sendInlineBotResult#f7bc68ba: field reply_to: %w" , err )
}
}
b .PutLong (s .RandomID )
b .PutLong (s .QueryID )
b .PutString (s .ID )
if s .Flags .Has (10 ) {
b .PutInt (s .ScheduleDate )
}
if s .Flags .Has (13 ) {
if s .SendAs == nil {
return fmt .Errorf ("unable to encode messages.sendInlineBotResult#f7bc68ba: field send_as is nil" )
}
if err := s .SendAs .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.sendInlineBotResult#f7bc68ba: field send_as: %w" , err )
}
}
return nil
}
func (s *MessagesSendInlineBotResultRequest ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode messages.sendInlineBotResult#f7bc68ba to nil" )
}
if err := b .ConsumeID (MessagesSendInlineBotResultRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.sendInlineBotResult#f7bc68ba: %w" , err )
}
return s .DecodeBare (b )
}
func (s *MessagesSendInlineBotResultRequest ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode messages.sendInlineBotResult#f7bc68ba to nil" )
}
{
if err := s .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode messages.sendInlineBotResult#f7bc68ba: field flags: %w" , err )
}
}
s .Silent = s .Flags .Has (5 )
s .Background = s .Flags .Has (6 )
s .ClearDraft = s .Flags .Has (7 )
s .HideVia = s .Flags .Has (11 )
{
value , err := DecodeInputPeer (b )
if err != nil {
return fmt .Errorf ("unable to decode messages.sendInlineBotResult#f7bc68ba: field peer: %w" , err )
}
s .Peer = value
}
if s .Flags .Has (0 ) {
value , err := DecodeInputReplyTo (b )
if err != nil {
return fmt .Errorf ("unable to decode messages.sendInlineBotResult#f7bc68ba: field reply_to: %w" , err )
}
s .ReplyTo = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode messages.sendInlineBotResult#f7bc68ba: field random_id: %w" , err )
}
s .RandomID = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode messages.sendInlineBotResult#f7bc68ba: field query_id: %w" , err )
}
s .QueryID = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode messages.sendInlineBotResult#f7bc68ba: field id: %w" , err )
}
s .ID = value
}
if s .Flags .Has (10 ) {
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode messages.sendInlineBotResult#f7bc68ba: field schedule_date: %w" , err )
}
s .ScheduleDate = value
}
if s .Flags .Has (13 ) {
value , err := DecodeInputPeer (b )
if err != nil {
return fmt .Errorf ("unable to decode messages.sendInlineBotResult#f7bc68ba: field send_as: %w" , err )
}
s .SendAs = value
}
return nil
}
func (s *MessagesSendInlineBotResultRequest ) SetSilent (value bool ) {
if value {
s .Flags .Set (5 )
s .Silent = true
} else {
s .Flags .Unset (5 )
s .Silent = false
}
}
func (s *MessagesSendInlineBotResultRequest ) GetSilent () (value bool ) {
if s == nil {
return
}
return s .Flags .Has (5 )
}
func (s *MessagesSendInlineBotResultRequest ) SetBackground (value bool ) {
if value {
s .Flags .Set (6 )
s .Background = true
} else {
s .Flags .Unset (6 )
s .Background = false
}
}
func (s *MessagesSendInlineBotResultRequest ) GetBackground () (value bool ) {
if s == nil {
return
}
return s .Flags .Has (6 )
}
func (s *MessagesSendInlineBotResultRequest ) SetClearDraft (value bool ) {
if value {
s .Flags .Set (7 )
s .ClearDraft = true
} else {
s .Flags .Unset (7 )
s .ClearDraft = false
}
}
func (s *MessagesSendInlineBotResultRequest ) GetClearDraft () (value bool ) {
if s == nil {
return
}
return s .Flags .Has (7 )
}
func (s *MessagesSendInlineBotResultRequest ) SetHideVia (value bool ) {
if value {
s .Flags .Set (11 )
s .HideVia = true
} else {
s .Flags .Unset (11 )
s .HideVia = false
}
}
func (s *MessagesSendInlineBotResultRequest ) GetHideVia () (value bool ) {
if s == nil {
return
}
return s .Flags .Has (11 )
}
func (s *MessagesSendInlineBotResultRequest ) GetPeer () (value InputPeerClass ) {
if s == nil {
return
}
return s .Peer
}
func (s *MessagesSendInlineBotResultRequest ) SetReplyTo (value InputReplyToClass ) {
s .Flags .Set (0 )
s .ReplyTo = value
}
func (s *MessagesSendInlineBotResultRequest ) GetReplyTo () (value InputReplyToClass , ok bool ) {
if s == nil {
return
}
if !s .Flags .Has (0 ) {
return value , false
}
return s .ReplyTo , true
}
func (s *MessagesSendInlineBotResultRequest ) GetRandomID () (value int64 ) {
if s == nil {
return
}
return s .RandomID
}
func (s *MessagesSendInlineBotResultRequest ) GetQueryID () (value int64 ) {
if s == nil {
return
}
return s .QueryID
}
func (s *MessagesSendInlineBotResultRequest ) GetID () (value string ) {
if s == nil {
return
}
return s .ID
}
func (s *MessagesSendInlineBotResultRequest ) SetScheduleDate (value int ) {
s .Flags .Set (10 )
s .ScheduleDate = value
}
func (s *MessagesSendInlineBotResultRequest ) GetScheduleDate () (value int , ok bool ) {
if s == nil {
return
}
if !s .Flags .Has (10 ) {
return value , false
}
return s .ScheduleDate , true
}
func (s *MessagesSendInlineBotResultRequest ) SetSendAs (value InputPeerClass ) {
s .Flags .Set (13 )
s .SendAs = value
}
func (s *MessagesSendInlineBotResultRequest ) GetSendAs () (value InputPeerClass , ok bool ) {
if s == nil {
return
}
if !s .Flags .Has (13 ) {
return value , false
}
return s .SendAs , true
}
func (c *Client ) MessagesSendInlineBotResult (ctx context .Context , request *MessagesSendInlineBotResultRequest ) (UpdatesClass , error ) {
var result UpdatesBox
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return nil , err
}
return result .Updates , nil
}
The pages are generated with Golds v0.6.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 @Go100and1 (reachable from the left QR code) to get the latest news of Golds .