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 ChannelsSetEmojiStickersRequest struct {
Channel InputChannelClass
Stickerset InputStickerSetClass
}
const ChannelsSetEmojiStickersRequestTypeID = 0x3cd930b7
var (
_ bin .Encoder = &ChannelsSetEmojiStickersRequest {}
_ bin .Decoder = &ChannelsSetEmojiStickersRequest {}
_ bin .BareEncoder = &ChannelsSetEmojiStickersRequest {}
_ bin .BareDecoder = &ChannelsSetEmojiStickersRequest {}
)
func (s *ChannelsSetEmojiStickersRequest ) Zero () bool {
if s == nil {
return true
}
if !(s .Channel == nil ) {
return false
}
if !(s .Stickerset == nil ) {
return false
}
return true
}
func (s *ChannelsSetEmojiStickersRequest ) String () string {
if s == nil {
return "ChannelsSetEmojiStickersRequest(nil)"
}
type Alias ChannelsSetEmojiStickersRequest
return fmt .Sprintf ("ChannelsSetEmojiStickersRequest%+v" , Alias (*s ))
}
func (s *ChannelsSetEmojiStickersRequest ) FillFrom (from interface {
GetChannel () (value InputChannelClass )
GetStickerset () (value InputStickerSetClass )
}) {
s .Channel = from .GetChannel ()
s .Stickerset = from .GetStickerset ()
}
func (*ChannelsSetEmojiStickersRequest ) TypeID () uint32 {
return ChannelsSetEmojiStickersRequestTypeID
}
func (*ChannelsSetEmojiStickersRequest ) TypeName () string {
return "channels.setEmojiStickers"
}
func (s *ChannelsSetEmojiStickersRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "channels.setEmojiStickers" ,
ID : ChannelsSetEmojiStickersRequestTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Channel" ,
SchemaName : "channel" ,
},
{
Name : "Stickerset" ,
SchemaName : "stickerset" ,
},
}
return typ
}
func (s *ChannelsSetEmojiStickersRequest ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode channels.setEmojiStickers#3cd930b7 as nil" )
}
b .PutID (ChannelsSetEmojiStickersRequestTypeID )
return s .EncodeBare (b )
}
func (s *ChannelsSetEmojiStickersRequest ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode channels.setEmojiStickers#3cd930b7 as nil" )
}
if s .Channel == nil {
return fmt .Errorf ("unable to encode channels.setEmojiStickers#3cd930b7: field channel is nil" )
}
if err := s .Channel .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode channels.setEmojiStickers#3cd930b7: field channel: %w" , err )
}
if s .Stickerset == nil {
return fmt .Errorf ("unable to encode channels.setEmojiStickers#3cd930b7: field stickerset is nil" )
}
if err := s .Stickerset .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode channels.setEmojiStickers#3cd930b7: field stickerset: %w" , err )
}
return nil
}
func (s *ChannelsSetEmojiStickersRequest ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode channels.setEmojiStickers#3cd930b7 to nil" )
}
if err := b .ConsumeID (ChannelsSetEmojiStickersRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode channels.setEmojiStickers#3cd930b7: %w" , err )
}
return s .DecodeBare (b )
}
func (s *ChannelsSetEmojiStickersRequest ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode channels.setEmojiStickers#3cd930b7 to nil" )
}
{
value , err := DecodeInputChannel (b )
if err != nil {
return fmt .Errorf ("unable to decode channels.setEmojiStickers#3cd930b7: field channel: %w" , err )
}
s .Channel = value
}
{
value , err := DecodeInputStickerSet (b )
if err != nil {
return fmt .Errorf ("unable to decode channels.setEmojiStickers#3cd930b7: field stickerset: %w" , err )
}
s .Stickerset = value
}
return nil
}
func (s *ChannelsSetEmojiStickersRequest ) GetChannel () (value InputChannelClass ) {
if s == nil {
return
}
return s .Channel
}
func (s *ChannelsSetEmojiStickersRequest ) GetStickerset () (value InputStickerSetClass ) {
if s == nil {
return
}
return s .Stickerset
}
func (s *ChannelsSetEmojiStickersRequest ) GetChannelAsNotEmpty () (NotEmptyInputChannel , bool ) {
return s .Channel .AsNotEmpty ()
}
func (c *Client ) ChannelsSetEmojiStickers (ctx context .Context , request *ChannelsSetEmojiStickersRequest ) (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.8.4 . (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 @zigo_101 (reachable from the left QR code) to get the latest news of Golds .