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 BotsSetBotBroadcastDefaultAdminRightsRequest struct {
AdminRights ChatAdminRights
}
const BotsSetBotBroadcastDefaultAdminRightsRequestTypeID = 0x788464e1
var (
_ bin .Encoder = &BotsSetBotBroadcastDefaultAdminRightsRequest {}
_ bin .Decoder = &BotsSetBotBroadcastDefaultAdminRightsRequest {}
_ bin .BareEncoder = &BotsSetBotBroadcastDefaultAdminRightsRequest {}
_ bin .BareDecoder = &BotsSetBotBroadcastDefaultAdminRightsRequest {}
)
func (s *BotsSetBotBroadcastDefaultAdminRightsRequest ) Zero () bool {
if s == nil {
return true
}
if !(s .AdminRights .Zero ()) {
return false
}
return true
}
func (s *BotsSetBotBroadcastDefaultAdminRightsRequest ) String () string {
if s == nil {
return "BotsSetBotBroadcastDefaultAdminRightsRequest(nil)"
}
type Alias BotsSetBotBroadcastDefaultAdminRightsRequest
return fmt .Sprintf ("BotsSetBotBroadcastDefaultAdminRightsRequest%+v" , Alias (*s ))
}
func (s *BotsSetBotBroadcastDefaultAdminRightsRequest ) FillFrom (from interface {
GetAdminRights () (value ChatAdminRights )
}) {
s .AdminRights = from .GetAdminRights ()
}
func (*BotsSetBotBroadcastDefaultAdminRightsRequest ) TypeID () uint32 {
return BotsSetBotBroadcastDefaultAdminRightsRequestTypeID
}
func (*BotsSetBotBroadcastDefaultAdminRightsRequest ) TypeName () string {
return "bots.setBotBroadcastDefaultAdminRights"
}
func (s *BotsSetBotBroadcastDefaultAdminRightsRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "bots.setBotBroadcastDefaultAdminRights" ,
ID : BotsSetBotBroadcastDefaultAdminRightsRequestTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "AdminRights" ,
SchemaName : "admin_rights" ,
},
}
return typ
}
func (s *BotsSetBotBroadcastDefaultAdminRightsRequest ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode bots.setBotBroadcastDefaultAdminRights#788464e1 as nil" )
}
b .PutID (BotsSetBotBroadcastDefaultAdminRightsRequestTypeID )
return s .EncodeBare (b )
}
func (s *BotsSetBotBroadcastDefaultAdminRightsRequest ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode bots.setBotBroadcastDefaultAdminRights#788464e1 as nil" )
}
if err := s .AdminRights .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode bots.setBotBroadcastDefaultAdminRights#788464e1: field admin_rights: %w" , err )
}
return nil
}
func (s *BotsSetBotBroadcastDefaultAdminRightsRequest ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode bots.setBotBroadcastDefaultAdminRights#788464e1 to nil" )
}
if err := b .ConsumeID (BotsSetBotBroadcastDefaultAdminRightsRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode bots.setBotBroadcastDefaultAdminRights#788464e1: %w" , err )
}
return s .DecodeBare (b )
}
func (s *BotsSetBotBroadcastDefaultAdminRightsRequest ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode bots.setBotBroadcastDefaultAdminRights#788464e1 to nil" )
}
{
if err := s .AdminRights .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode bots.setBotBroadcastDefaultAdminRights#788464e1: field admin_rights: %w" , err )
}
}
return nil
}
func (s *BotsSetBotBroadcastDefaultAdminRightsRequest ) GetAdminRights () (value ChatAdminRights ) {
if s == nil {
return
}
return s .AdminRights
}
func (c *Client ) BotsSetBotBroadcastDefaultAdminRights (ctx context .Context , adminrights ChatAdminRights ) (bool , error ) {
var result BoolBox
request := &BotsSetBotBroadcastDefaultAdminRightsRequest {
AdminRights : adminrights ,
}
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 .