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 MessagesStartBotRequest struct {
Bot InputUserClass
Peer InputPeerClass
RandomID int64
StartParam string
}
const MessagesStartBotRequestTypeID = 0xe6df7378
var (
_ bin .Encoder = &MessagesStartBotRequest {}
_ bin .Decoder = &MessagesStartBotRequest {}
_ bin .BareEncoder = &MessagesStartBotRequest {}
_ bin .BareDecoder = &MessagesStartBotRequest {}
)
func (s *MessagesStartBotRequest ) Zero () bool {
if s == nil {
return true
}
if !(s .Bot == nil ) {
return false
}
if !(s .Peer == nil ) {
return false
}
if !(s .RandomID == 0 ) {
return false
}
if !(s .StartParam == "" ) {
return false
}
return true
}
func (s *MessagesStartBotRequest ) String () string {
if s == nil {
return "MessagesStartBotRequest(nil)"
}
type Alias MessagesStartBotRequest
return fmt .Sprintf ("MessagesStartBotRequest%+v" , Alias (*s ))
}
func (s *MessagesStartBotRequest ) FillFrom (from interface {
GetBot () (value InputUserClass )
GetPeer () (value InputPeerClass )
GetRandomID () (value int64 )
GetStartParam () (value string )
}) {
s .Bot = from .GetBot ()
s .Peer = from .GetPeer ()
s .RandomID = from .GetRandomID ()
s .StartParam = from .GetStartParam ()
}
func (*MessagesStartBotRequest ) TypeID () uint32 {
return MessagesStartBotRequestTypeID
}
func (*MessagesStartBotRequest ) TypeName () string {
return "messages.startBot"
}
func (s *MessagesStartBotRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messages.startBot" ,
ID : MessagesStartBotRequestTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Bot" ,
SchemaName : "bot" ,
},
{
Name : "Peer" ,
SchemaName : "peer" ,
},
{
Name : "RandomID" ,
SchemaName : "random_id" ,
},
{
Name : "StartParam" ,
SchemaName : "start_param" ,
},
}
return typ
}
func (s *MessagesStartBotRequest ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode messages.startBot#e6df7378 as nil" )
}
b .PutID (MessagesStartBotRequestTypeID )
return s .EncodeBare (b )
}
func (s *MessagesStartBotRequest ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode messages.startBot#e6df7378 as nil" )
}
if s .Bot == nil {
return fmt .Errorf ("unable to encode messages.startBot#e6df7378: field bot is nil" )
}
if err := s .Bot .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.startBot#e6df7378: field bot: %w" , err )
}
if s .Peer == nil {
return fmt .Errorf ("unable to encode messages.startBot#e6df7378: field peer is nil" )
}
if err := s .Peer .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messages.startBot#e6df7378: field peer: %w" , err )
}
b .PutLong (s .RandomID )
b .PutString (s .StartParam )
return nil
}
func (s *MessagesStartBotRequest ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode messages.startBot#e6df7378 to nil" )
}
if err := b .ConsumeID (MessagesStartBotRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode messages.startBot#e6df7378: %w" , err )
}
return s .DecodeBare (b )
}
func (s *MessagesStartBotRequest ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode messages.startBot#e6df7378 to nil" )
}
{
value , err := DecodeInputUser (b )
if err != nil {
return fmt .Errorf ("unable to decode messages.startBot#e6df7378: field bot: %w" , err )
}
s .Bot = value
}
{
value , err := DecodeInputPeer (b )
if err != nil {
return fmt .Errorf ("unable to decode messages.startBot#e6df7378: field peer: %w" , err )
}
s .Peer = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode messages.startBot#e6df7378: field random_id: %w" , err )
}
s .RandomID = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode messages.startBot#e6df7378: field start_param: %w" , err )
}
s .StartParam = value
}
return nil
}
func (s *MessagesStartBotRequest ) GetBot () (value InputUserClass ) {
if s == nil {
return
}
return s .Bot
}
func (s *MessagesStartBotRequest ) GetPeer () (value InputPeerClass ) {
if s == nil {
return
}
return s .Peer
}
func (s *MessagesStartBotRequest ) GetRandomID () (value int64 ) {
if s == nil {
return
}
return s .RandomID
}
func (s *MessagesStartBotRequest ) GetStartParam () (value string ) {
if s == nil {
return
}
return s .StartParam
}
func (c *Client ) MessagesStartBot (ctx context .Context , request *MessagesStartBotRequest ) (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 .