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 BotsAllowSendMessageRequest struct {
Bot InputUserClass
}
const BotsAllowSendMessageRequestTypeID = 0xf132e3ef
var (
_ bin .Encoder = &BotsAllowSendMessageRequest {}
_ bin .Decoder = &BotsAllowSendMessageRequest {}
_ bin .BareEncoder = &BotsAllowSendMessageRequest {}
_ bin .BareDecoder = &BotsAllowSendMessageRequest {}
)
func (a *BotsAllowSendMessageRequest ) Zero () bool {
if a == nil {
return true
}
if !(a .Bot == nil ) {
return false
}
return true
}
func (a *BotsAllowSendMessageRequest ) String () string {
if a == nil {
return "BotsAllowSendMessageRequest(nil)"
}
type Alias BotsAllowSendMessageRequest
return fmt .Sprintf ("BotsAllowSendMessageRequest%+v" , Alias (*a ))
}
func (a *BotsAllowSendMessageRequest ) FillFrom (from interface {
GetBot () (value InputUserClass )
}) {
a .Bot = from .GetBot ()
}
func (*BotsAllowSendMessageRequest ) TypeID () uint32 {
return BotsAllowSendMessageRequestTypeID
}
func (*BotsAllowSendMessageRequest ) TypeName () string {
return "bots.allowSendMessage"
}
func (a *BotsAllowSendMessageRequest ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "bots.allowSendMessage" ,
ID : BotsAllowSendMessageRequestTypeID ,
}
if a == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Bot" ,
SchemaName : "bot" ,
},
}
return typ
}
func (a *BotsAllowSendMessageRequest ) Encode (b *bin .Buffer ) error {
if a == nil {
return fmt .Errorf ("can't encode bots.allowSendMessage#f132e3ef as nil" )
}
b .PutID (BotsAllowSendMessageRequestTypeID )
return a .EncodeBare (b )
}
func (a *BotsAllowSendMessageRequest ) EncodeBare (b *bin .Buffer ) error {
if a == nil {
return fmt .Errorf ("can't encode bots.allowSendMessage#f132e3ef as nil" )
}
if a .Bot == nil {
return fmt .Errorf ("unable to encode bots.allowSendMessage#f132e3ef: field bot is nil" )
}
if err := a .Bot .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode bots.allowSendMessage#f132e3ef: field bot: %w" , err )
}
return nil
}
func (a *BotsAllowSendMessageRequest ) Decode (b *bin .Buffer ) error {
if a == nil {
return fmt .Errorf ("can't decode bots.allowSendMessage#f132e3ef to nil" )
}
if err := b .ConsumeID (BotsAllowSendMessageRequestTypeID ); err != nil {
return fmt .Errorf ("unable to decode bots.allowSendMessage#f132e3ef: %w" , err )
}
return a .DecodeBare (b )
}
func (a *BotsAllowSendMessageRequest ) DecodeBare (b *bin .Buffer ) error {
if a == nil {
return fmt .Errorf ("can't decode bots.allowSendMessage#f132e3ef to nil" )
}
{
value , err := DecodeInputUser (b )
if err != nil {
return fmt .Errorf ("unable to decode bots.allowSendMessage#f132e3ef: field bot: %w" , err )
}
a .Bot = value
}
return nil
}
func (a *BotsAllowSendMessageRequest ) GetBot () (value InputUserClass ) {
if a == nil {
return
}
return a .Bot
}
func (c *Client ) BotsAllowSendMessage (ctx context .Context , bot InputUserClass ) (UpdatesClass , error ) {
var result UpdatesBox
request := &BotsAllowSendMessageRequest {
Bot : bot ,
}
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 .