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 BotsResetBotCommandsRequest struct {
Scope BotCommandScopeClass
LangCode string
}
const BotsResetBotCommandsRequestTypeID = 0x3d8de0f9
var (
_ bin .Encoder = &BotsResetBotCommandsRequest {}
_ bin .Decoder = &BotsResetBotCommandsRequest {}
_ bin .BareEncoder = &BotsResetBotCommandsRequest {}
_ bin .BareDecoder = &BotsResetBotCommandsRequest {}
)
func (r *BotsResetBotCommandsRequest ) Zero () bool {
if r == nil {
return true
}
if !(r .Scope == nil ) {
return false
}
if !(r .LangCode == "" ) {
return false
}
return true
}
func (r *BotsResetBotCommandsRequest ) String () string {
if r == nil {
return "BotsResetBotCommandsRequest(nil)"
}
type Alias BotsResetBotCommandsRequest
return fmt .Sprintf ("BotsResetBotCommandsRequest%+v" , Alias (*r ))
}
func (r *BotsResetBotCommandsRequest ) FillFrom (from interface {
GetScope () (value BotCommandScopeClass )
GetLangCode () (value string )
}) {
r .Scope = from .GetScope ()
r .LangCode = from .GetLangCode ()
}
func (*BotsResetBotCommandsRequest ) TypeID () uint32 {
return BotsResetBotCommandsRequestTypeID
}
func (*BotsResetBotCommandsRequest ) TypeName () string {
return "bots.resetBotCommands"
}
func (r *BotsResetBotCommandsRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "bots.resetBotCommands" ,
ID : BotsResetBotCommandsRequestTypeID ,
}
if r == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Scope" ,
SchemaName : "scope" ,
},
{
Name : "LangCode" ,
SchemaName : "lang_code" ,
},
}
return typ
}
func (r *BotsResetBotCommandsRequest ) Encode (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't encode bots.resetBotCommands#3d8de0f9 as nil" )
}
b .PutID (BotsResetBotCommandsRequestTypeID )
return r .EncodeBare (b )
}
func (r *BotsResetBotCommandsRequest ) EncodeBare (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't encode bots.resetBotCommands#3d8de0f9 as nil" )
}
if r .Scope == nil {
return fmt .Errorf ("unable to encode bots.resetBotCommands#3d8de0f9: field scope is nil" )
}
if err := r .Scope .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode bots.resetBotCommands#3d8de0f9: field scope: %w" , err )
}
b .PutString (r .LangCode )
return nil
}
func (r *BotsResetBotCommandsRequest ) Decode (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't decode bots.resetBotCommands#3d8de0f9 to nil" )
}
if err := b .ConsumeID (BotsResetBotCommandsRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode bots.resetBotCommands#3d8de0f9: %w" , err )
}
return r .DecodeBare (b )
}
func (r *BotsResetBotCommandsRequest ) DecodeBare (b *bin .Buffer ) error {
if r == nil {
return fmt .Errorf ("can't decode bots.resetBotCommands#3d8de0f9 to nil" )
}
{
value , err := DecodeBotCommandScope (b )
if err != nil {
return fmt .Errorf ("unable to decode bots.resetBotCommands#3d8de0f9: field scope: %w" , err )
}
r .Scope = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode bots.resetBotCommands#3d8de0f9: field lang_code: %w" , err )
}
r .LangCode = value
}
return nil
}
func (r *BotsResetBotCommandsRequest ) GetScope () (value BotCommandScopeClass ) {
if r == nil {
return
}
return r .Scope
}
func (r *BotsResetBotCommandsRequest ) GetLangCode () (value string ) {
if r == nil {
return
}
return r .LangCode
}
func (c *Client ) BotsResetBotCommands (ctx context .Context , request *BotsResetBotCommandsRequest ) (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 .