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 BotsSetBotInfoRequest struct {
Flags bin .Fields
Bot InputUserClass
LangCode string
Name string
About string
Description string
}
const BotsSetBotInfoRequestTypeID = 0x10cf3123
var (
_ bin .Encoder = &BotsSetBotInfoRequest {}
_ bin .Decoder = &BotsSetBotInfoRequest {}
_ bin .BareEncoder = &BotsSetBotInfoRequest {}
_ bin .BareDecoder = &BotsSetBotInfoRequest {}
)
func (s *BotsSetBotInfoRequest ) Zero () bool {
if s == nil {
return true
}
if !(s .Flags .Zero ()) {
return false
}
if !(s .Bot == nil ) {
return false
}
if !(s .LangCode == "" ) {
return false
}
if !(s .Name == "" ) {
return false
}
if !(s .About == "" ) {
return false
}
if !(s .Description == "" ) {
return false
}
return true
}
func (s *BotsSetBotInfoRequest ) String () string {
if s == nil {
return "BotsSetBotInfoRequest(nil)"
}
type Alias BotsSetBotInfoRequest
return fmt .Sprintf ("BotsSetBotInfoRequest%+v" , Alias (*s ))
}
func (s *BotsSetBotInfoRequest ) FillFrom (from interface {
GetBot () (value InputUserClass , ok bool )
GetLangCode () (value string )
GetName () (value string , ok bool )
GetAbout () (value string , ok bool )
GetDescription () (value string , ok bool )
}) {
if val , ok := from .GetBot (); ok {
s .Bot = val
}
s .LangCode = from .GetLangCode ()
if val , ok := from .GetName (); ok {
s .Name = val
}
if val , ok := from .GetAbout (); ok {
s .About = val
}
if val , ok := from .GetDescription (); ok {
s .Description = val
}
}
func (*BotsSetBotInfoRequest ) TypeID () uint32 {
return BotsSetBotInfoRequestTypeID
}
func (*BotsSetBotInfoRequest ) TypeName () string {
return "bots.setBotInfo"
}
func (s *BotsSetBotInfoRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "bots.setBotInfo" ,
ID : BotsSetBotInfoRequestTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Bot" ,
SchemaName : "bot" ,
Null : !s .Flags .Has (2 ),
},
{
Name : "LangCode" ,
SchemaName : "lang_code" ,
},
{
Name : "Name" ,
SchemaName : "name" ,
Null : !s .Flags .Has (3 ),
},
{
Name : "About" ,
SchemaName : "about" ,
Null : !s .Flags .Has (0 ),
},
{
Name : "Description" ,
SchemaName : "description" ,
Null : !s .Flags .Has (1 ),
},
}
return typ
}
func (s *BotsSetBotInfoRequest ) SetFlags () {
if !(s .Bot == nil ) {
s .Flags .Set (2 )
}
if !(s .Name == "" ) {
s .Flags .Set (3 )
}
if !(s .About == "" ) {
s .Flags .Set (0 )
}
if !(s .Description == "" ) {
s .Flags .Set (1 )
}
}
func (s *BotsSetBotInfoRequest ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode bots.setBotInfo#10cf3123 as nil" )
}
b .PutID (BotsSetBotInfoRequestTypeID )
return s .EncodeBare (b )
}
func (s *BotsSetBotInfoRequest ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode bots.setBotInfo#10cf3123 as nil" )
}
s .SetFlags ()
if err := s .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode bots.setBotInfo#10cf3123: field flags: %w" , err )
}
if s .Flags .Has (2 ) {
if s .Bot == nil {
return fmt .Errorf ("unable to encode bots.setBotInfo#10cf3123: field bot is nil" )
}
if err := s .Bot .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode bots.setBotInfo#10cf3123: field bot: %w" , err )
}
}
b .PutString (s .LangCode )
if s .Flags .Has (3 ) {
b .PutString (s .Name )
}
if s .Flags .Has (0 ) {
b .PutString (s .About )
}
if s .Flags .Has (1 ) {
b .PutString (s .Description )
}
return nil
}
func (s *BotsSetBotInfoRequest ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode bots.setBotInfo#10cf3123 to nil" )
}
if err := b .ConsumeID (BotsSetBotInfoRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode bots.setBotInfo#10cf3123: %w" , err )
}
return s .DecodeBare (b )
}
func (s *BotsSetBotInfoRequest ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode bots.setBotInfo#10cf3123 to nil" )
}
{
if err := s .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode bots.setBotInfo#10cf3123: field flags: %w" , err )
}
}
if s .Flags .Has (2 ) {
value , err := DecodeInputUser (b )
if err != nil {
return fmt .Errorf ("unable to decode bots.setBotInfo#10cf3123: field bot: %w" , err )
}
s .Bot = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode bots.setBotInfo#10cf3123: field lang_code: %w" , err )
}
s .LangCode = value
}
if s .Flags .Has (3 ) {
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode bots.setBotInfo#10cf3123: field name: %w" , err )
}
s .Name = value
}
if s .Flags .Has (0 ) {
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode bots.setBotInfo#10cf3123: field about: %w" , err )
}
s .About = value
}
if s .Flags .Has (1 ) {
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode bots.setBotInfo#10cf3123: field description: %w" , err )
}
s .Description = value
}
return nil
}
func (s *BotsSetBotInfoRequest ) SetBot (value InputUserClass ) {
s .Flags .Set (2 )
s .Bot = value
}
func (s *BotsSetBotInfoRequest ) GetBot () (value InputUserClass , ok bool ) {
if s == nil {
return
}
if !s .Flags .Has (2 ) {
return value , false
}
return s .Bot , true
}
func (s *BotsSetBotInfoRequest ) GetLangCode () (value string ) {
if s == nil {
return
}
return s .LangCode
}
func (s *BotsSetBotInfoRequest ) SetName (value string ) {
s .Flags .Set (3 )
s .Name = value
}
func (s *BotsSetBotInfoRequest ) GetName () (value string , ok bool ) {
if s == nil {
return
}
if !s .Flags .Has (3 ) {
return value , false
}
return s .Name , true
}
func (s *BotsSetBotInfoRequest ) SetAbout (value string ) {
s .Flags .Set (0 )
s .About = value
}
func (s *BotsSetBotInfoRequest ) GetAbout () (value string , ok bool ) {
if s == nil {
return
}
if !s .Flags .Has (0 ) {
return value , false
}
return s .About , true
}
func (s *BotsSetBotInfoRequest ) SetDescription (value string ) {
s .Flags .Set (1 )
s .Description = value
}
func (s *BotsSetBotInfoRequest ) GetDescription () (value string , ok bool ) {
if s == nil {
return
}
if !s .Flags .Has (1 ) {
return value , false
}
return s .Description , true
}
func (c *Client ) BotsSetBotInfo (ctx context .Context , request *BotsSetBotInfoRequest ) (bool , error ) {
var result BoolBox
if err := c .rpc .Invoke (ctx , request , &result ); err != nil {
return false , err
}
_ , ok := result .Bool .(*BoolTrue )
return ok , 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 .