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 BotInlineMessageMediaAuto struct {
Flags bin .Fields
InvertMedia bool
Message string
Entities []MessageEntityClass
ReplyMarkup ReplyMarkupClass
}
const BotInlineMessageMediaAutoTypeID = 0x764cf810
func (b BotInlineMessageMediaAuto ) construct () BotInlineMessageClass { return &b }
var (
_ bin .Encoder = &BotInlineMessageMediaAuto {}
_ bin .Decoder = &BotInlineMessageMediaAuto {}
_ bin .BareEncoder = &BotInlineMessageMediaAuto {}
_ bin .BareDecoder = &BotInlineMessageMediaAuto {}
_ BotInlineMessageClass = &BotInlineMessageMediaAuto {}
)
func (b *BotInlineMessageMediaAuto ) Zero () bool {
if b == nil {
return true
}
if !(b .Flags .Zero ()) {
return false
}
if !(b .InvertMedia == false ) {
return false
}
if !(b .Message == "" ) {
return false
}
if !(b .Entities == nil ) {
return false
}
if !(b .ReplyMarkup == nil ) {
return false
}
return true
}
func (b *BotInlineMessageMediaAuto ) String () string {
if b == nil {
return "BotInlineMessageMediaAuto(nil)"
}
type Alias BotInlineMessageMediaAuto
return fmt .Sprintf ("BotInlineMessageMediaAuto%+v" , Alias (*b ))
}
func (b *BotInlineMessageMediaAuto ) FillFrom (from interface {
GetInvertMedia () (value bool )
GetMessage () (value string )
GetEntities () (value []MessageEntityClass , ok bool )
GetReplyMarkup () (value ReplyMarkupClass , ok bool )
}) {
b .InvertMedia = from .GetInvertMedia ()
b .Message = from .GetMessage ()
if val , ok := from .GetEntities (); ok {
b .Entities = val
}
if val , ok := from .GetReplyMarkup (); ok {
b .ReplyMarkup = val
}
}
func (*BotInlineMessageMediaAuto ) TypeID () uint32 {
return BotInlineMessageMediaAutoTypeID
}
func (*BotInlineMessageMediaAuto ) TypeName () string {
return "botInlineMessageMediaAuto"
}
func (b *BotInlineMessageMediaAuto ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "botInlineMessageMediaAuto" ,
ID : BotInlineMessageMediaAutoTypeID ,
}
if b == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "InvertMedia" ,
SchemaName : "invert_media" ,
Null : !b .Flags .Has (3 ),
},
{
Name : "Message" ,
SchemaName : "message" ,
},
{
Name : "Entities" ,
SchemaName : "entities" ,
Null : !b .Flags .Has (1 ),
},
{
Name : "ReplyMarkup" ,
SchemaName : "reply_markup" ,
Null : !b .Flags .Has (2 ),
},
}
return typ
}
func (b *BotInlineMessageMediaAuto ) SetFlags () {
if !(b .InvertMedia == false ) {
b .Flags .Set (3 )
}
if !(b .Entities == nil ) {
b .Flags .Set (1 )
}
if !(b .ReplyMarkup == nil ) {
b .Flags .Set (2 )
}
}
func (b *BotInlineMessageMediaAuto ) Encode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't encode botInlineMessageMediaAuto#764cf810 as nil" )
}
buf .PutID (BotInlineMessageMediaAutoTypeID )
return b .EncodeBare (buf )
}
func (b *BotInlineMessageMediaAuto ) EncodeBare (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't encode botInlineMessageMediaAuto#764cf810 as nil" )
}
b .SetFlags ()
if err := b .Flags .Encode (buf ); err != nil {
return fmt .Errorf ("unable to encode botInlineMessageMediaAuto#764cf810: field flags: %w" , err )
}
buf .PutString (b .Message )
if b .Flags .Has (1 ) {
buf .PutVectorHeader (len (b .Entities ))
for idx , v := range b .Entities {
if v == nil {
return fmt .Errorf ("unable to encode botInlineMessageMediaAuto#764cf810: field entities element with index %d is nil" , idx )
}
if err := v .Encode (buf ); err != nil {
return fmt .Errorf ("unable to encode botInlineMessageMediaAuto#764cf810: field entities element with index %d: %w" , idx , err )
}
}
}
if b .Flags .Has (2 ) {
if b .ReplyMarkup == nil {
return fmt .Errorf ("unable to encode botInlineMessageMediaAuto#764cf810: field reply_markup is nil" )
}
if err := b .ReplyMarkup .Encode (buf ); err != nil {
return fmt .Errorf ("unable to encode botInlineMessageMediaAuto#764cf810: field reply_markup: %w" , err )
}
}
return nil
}
func (b *BotInlineMessageMediaAuto ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't decode botInlineMessageMediaAuto#764cf810 to nil" )
}
if err := buf .ConsumeID (BotInlineMessageMediaAutoTypeID ); err != nil {
return fmt .Errorf ("unable to decode botInlineMessageMediaAuto#764cf810: %w" , err )
}
return b .DecodeBare (buf )
}
func (b *BotInlineMessageMediaAuto ) DecodeBare (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't decode botInlineMessageMediaAuto#764cf810 to nil" )
}
{
if err := b .Flags .Decode (buf ); err != nil {
return fmt .Errorf ("unable to decode botInlineMessageMediaAuto#764cf810: field flags: %w" , err )
}
}
b .InvertMedia = b .Flags .Has (3 )
{
value , err := buf .String ()
if err != nil {
return fmt .Errorf ("unable to decode botInlineMessageMediaAuto#764cf810: field message: %w" , err )
}
b .Message = value
}
if b .Flags .Has (1 ) {
headerLen , err := buf .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode botInlineMessageMediaAuto#764cf810: field entities: %w" , err )
}
if headerLen > 0 {
b .Entities = make ([]MessageEntityClass , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
value , err := DecodeMessageEntity (buf )
if err != nil {
return fmt .Errorf ("unable to decode botInlineMessageMediaAuto#764cf810: field entities: %w" , err )
}
b .Entities = append (b .Entities , value )
}
}
if b .Flags .Has (2 ) {
value , err := DecodeReplyMarkup (buf )
if err != nil {
return fmt .Errorf ("unable to decode botInlineMessageMediaAuto#764cf810: field reply_markup: %w" , err )
}
b .ReplyMarkup = value
}
return nil
}
func (b *BotInlineMessageMediaAuto ) SetInvertMedia (value bool ) {
if value {
b .Flags .Set (3 )
b .InvertMedia = true
} else {
b .Flags .Unset (3 )
b .InvertMedia = false
}
}
func (b *BotInlineMessageMediaAuto ) GetInvertMedia () (value bool ) {
if b == nil {
return
}
return b .Flags .Has (3 )
}
func (b *BotInlineMessageMediaAuto ) GetMessage () (value string ) {
if b == nil {
return
}
return b .Message
}
func (b *BotInlineMessageMediaAuto ) SetEntities (value []MessageEntityClass ) {
b .Flags .Set (1 )
b .Entities = value
}
func (b *BotInlineMessageMediaAuto ) GetEntities () (value []MessageEntityClass , ok bool ) {
if b == nil {
return
}
if !b .Flags .Has (1 ) {
return value , false
}
return b .Entities , true
}
func (b *BotInlineMessageMediaAuto ) SetReplyMarkup (value ReplyMarkupClass ) {
b .Flags .Set (2 )
b .ReplyMarkup = value
}
func (b *BotInlineMessageMediaAuto ) GetReplyMarkup () (value ReplyMarkupClass , ok bool ) {
if b == nil {
return
}
if !b .Flags .Has (2 ) {
return value , false
}
return b .ReplyMarkup , true
}
func (b *BotInlineMessageMediaAuto ) MapEntities () (value MessageEntityClassArray , ok bool ) {
if !b .Flags .Has (1 ) {
return value , false
}
return MessageEntityClassArray (b .Entities ), true
}
type BotInlineMessageText struct {
Flags bin .Fields
NoWebpage bool
InvertMedia bool
Message string
Entities []MessageEntityClass
ReplyMarkup ReplyMarkupClass
}
const BotInlineMessageTextTypeID = 0x8c7f65e2
func (b BotInlineMessageText ) construct () BotInlineMessageClass { return &b }
var (
_ bin .Encoder = &BotInlineMessageText {}
_ bin .Decoder = &BotInlineMessageText {}
_ bin .BareEncoder = &BotInlineMessageText {}
_ bin .BareDecoder = &BotInlineMessageText {}
_ BotInlineMessageClass = &BotInlineMessageText {}
)
func (b *BotInlineMessageText ) Zero () bool {
if b == nil {
return true
}
if !(b .Flags .Zero ()) {
return false
}
if !(b .NoWebpage == false ) {
return false
}
if !(b .InvertMedia == false ) {
return false
}
if !(b .Message == "" ) {
return false
}
if !(b .Entities == nil ) {
return false
}
if !(b .ReplyMarkup == nil ) {
return false
}
return true
}
func (b *BotInlineMessageText ) String () string {
if b == nil {
return "BotInlineMessageText(nil)"
}
type Alias BotInlineMessageText
return fmt .Sprintf ("BotInlineMessageText%+v" , Alias (*b ))
}
func (b *BotInlineMessageText ) FillFrom (from interface {
GetNoWebpage () (value bool )
GetInvertMedia () (value bool )
GetMessage () (value string )
GetEntities () (value []MessageEntityClass , ok bool )
GetReplyMarkup () (value ReplyMarkupClass , ok bool )
}) {
b .NoWebpage = from .GetNoWebpage ()
b .InvertMedia = from .GetInvertMedia ()
b .Message = from .GetMessage ()
if val , ok := from .GetEntities (); ok {
b .Entities = val
}
if val , ok := from .GetReplyMarkup (); ok {
b .ReplyMarkup = val
}
}
func (*BotInlineMessageText ) TypeID () uint32 {
return BotInlineMessageTextTypeID
}
func (*BotInlineMessageText ) TypeName () string {
return "botInlineMessageText"
}
func (b *BotInlineMessageText ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "botInlineMessageText" ,
ID : BotInlineMessageTextTypeID ,
}
if b == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "NoWebpage" ,
SchemaName : "no_webpage" ,
Null : !b .Flags .Has (0 ),
},
{
Name : "InvertMedia" ,
SchemaName : "invert_media" ,
Null : !b .Flags .Has (3 ),
},
{
Name : "Message" ,
SchemaName : "message" ,
},
{
Name : "Entities" ,
SchemaName : "entities" ,
Null : !b .Flags .Has (1 ),
},
{
Name : "ReplyMarkup" ,
SchemaName : "reply_markup" ,
Null : !b .Flags .Has (2 ),
},
}
return typ
}
func (b *BotInlineMessageText ) SetFlags () {
if !(b .NoWebpage == false ) {
b .Flags .Set (0 )
}
if !(b .InvertMedia == false ) {
b .Flags .Set (3 )
}
if !(b .Entities == nil ) {
b .Flags .Set (1 )
}
if !(b .ReplyMarkup == nil ) {
b .Flags .Set (2 )
}
}
func (b *BotInlineMessageText ) Encode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't encode botInlineMessageText#8c7f65e2 as nil" )
}
buf .PutID (BotInlineMessageTextTypeID )
return b .EncodeBare (buf )
}
func (b *BotInlineMessageText ) EncodeBare (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't encode botInlineMessageText#8c7f65e2 as nil" )
}
b .SetFlags ()
if err := b .Flags .Encode (buf ); err != nil {
return fmt .Errorf ("unable to encode botInlineMessageText#8c7f65e2: field flags: %w" , err )
}
buf .PutString (b .Message )
if b .Flags .Has (1 ) {
buf .PutVectorHeader (len (b .Entities ))
for idx , v := range b .Entities {
if v == nil {
return fmt .Errorf ("unable to encode botInlineMessageText#8c7f65e2: field entities element with index %d is nil" , idx )
}
if err := v .Encode (buf ); err != nil {
return fmt .Errorf ("unable to encode botInlineMessageText#8c7f65e2: field entities element with index %d: %w" , idx , err )
}
}
}
if b .Flags .Has (2 ) {
if b .ReplyMarkup == nil {
return fmt .Errorf ("unable to encode botInlineMessageText#8c7f65e2: field reply_markup is nil" )
}
if err := b .ReplyMarkup .Encode (buf ); err != nil {
return fmt .Errorf ("unable to encode botInlineMessageText#8c7f65e2: field reply_markup: %w" , err )
}
}
return nil
}
func (b *BotInlineMessageText ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't decode botInlineMessageText#8c7f65e2 to nil" )
}
if err := buf .ConsumeID (BotInlineMessageTextTypeID ); err != nil {
return fmt .Errorf ("unable to decode botInlineMessageText#8c7f65e2: %w" , err )
}
return b .DecodeBare (buf )
}
func (b *BotInlineMessageText ) DecodeBare (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't decode botInlineMessageText#8c7f65e2 to nil" )
}
{
if err := b .Flags .Decode (buf ); err != nil {
return fmt .Errorf ("unable to decode botInlineMessageText#8c7f65e2: field flags: %w" , err )
}
}
b .NoWebpage = b .Flags .Has (0 )
b .InvertMedia = b .Flags .Has (3 )
{
value , err := buf .String ()
if err != nil {
return fmt .Errorf ("unable to decode botInlineMessageText#8c7f65e2: field message: %w" , err )
}
b .Message = value
}
if b .Flags .Has (1 ) {
headerLen , err := buf .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode botInlineMessageText#8c7f65e2: field entities: %w" , err )
}
if headerLen > 0 {
b .Entities = make ([]MessageEntityClass , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
value , err := DecodeMessageEntity (buf )
if err != nil {
return fmt .Errorf ("unable to decode botInlineMessageText#8c7f65e2: field entities: %w" , err )
}
b .Entities = append (b .Entities , value )
}
}
if b .Flags .Has (2 ) {
value , err := DecodeReplyMarkup (buf )
if err != nil {
return fmt .Errorf ("unable to decode botInlineMessageText#8c7f65e2: field reply_markup: %w" , err )
}
b .ReplyMarkup = value
}
return nil
}
func (b *BotInlineMessageText ) SetNoWebpage (value bool ) {
if value {
b .Flags .Set (0 )
b .NoWebpage = true
} else {
b .Flags .Unset (0 )
b .NoWebpage = false
}
}
func (b *BotInlineMessageText ) GetNoWebpage () (value bool ) {
if b == nil {
return
}
return b .Flags .Has (0 )
}
func (b *BotInlineMessageText ) SetInvertMedia (value bool ) {
if value {
b .Flags .Set (3 )
b .InvertMedia = true
} else {
b .Flags .Unset (3 )
b .InvertMedia = false
}
}
func (b *BotInlineMessageText ) GetInvertMedia () (value bool ) {
if b == nil {
return
}
return b .Flags .Has (3 )
}
func (b *BotInlineMessageText ) GetMessage () (value string ) {
if b == nil {
return
}
return b .Message
}
func (b *BotInlineMessageText ) SetEntities (value []MessageEntityClass ) {
b .Flags .Set (1 )
b .Entities = value
}
func (b *BotInlineMessageText ) GetEntities () (value []MessageEntityClass , ok bool ) {
if b == nil {
return
}
if !b .Flags .Has (1 ) {
return value , false
}
return b .Entities , true
}
func (b *BotInlineMessageText ) SetReplyMarkup (value ReplyMarkupClass ) {
b .Flags .Set (2 )
b .ReplyMarkup = value
}
func (b *BotInlineMessageText ) GetReplyMarkup () (value ReplyMarkupClass , ok bool ) {
if b == nil {
return
}
if !b .Flags .Has (2 ) {
return value , false
}
return b .ReplyMarkup , true
}
func (b *BotInlineMessageText ) MapEntities () (value MessageEntityClassArray , ok bool ) {
if !b .Flags .Has (1 ) {
return value , false
}
return MessageEntityClassArray (b .Entities ), true
}
type BotInlineMessageMediaGeo struct {
Flags bin .Fields
Geo GeoPointClass
Heading int
Period int
ProximityNotificationRadius int
ReplyMarkup ReplyMarkupClass
}
const BotInlineMessageMediaGeoTypeID = 0x51846fd
func (b BotInlineMessageMediaGeo ) construct () BotInlineMessageClass { return &b }
var (
_ bin .Encoder = &BotInlineMessageMediaGeo {}
_ bin .Decoder = &BotInlineMessageMediaGeo {}
_ bin .BareEncoder = &BotInlineMessageMediaGeo {}
_ bin .BareDecoder = &BotInlineMessageMediaGeo {}
_ BotInlineMessageClass = &BotInlineMessageMediaGeo {}
)
func (b *BotInlineMessageMediaGeo ) Zero () bool {
if b == nil {
return true
}
if !(b .Flags .Zero ()) {
return false
}
if !(b .Geo == nil ) {
return false
}
if !(b .Heading == 0 ) {
return false
}
if !(b .Period == 0 ) {
return false
}
if !(b .ProximityNotificationRadius == 0 ) {
return false
}
if !(b .ReplyMarkup == nil ) {
return false
}
return true
}
func (b *BotInlineMessageMediaGeo ) String () string {
if b == nil {
return "BotInlineMessageMediaGeo(nil)"
}
type Alias BotInlineMessageMediaGeo
return fmt .Sprintf ("BotInlineMessageMediaGeo%+v" , Alias (*b ))
}
func (b *BotInlineMessageMediaGeo ) FillFrom (from interface {
GetGeo () (value GeoPointClass )
GetHeading () (value int , ok bool )
GetPeriod () (value int , ok bool )
GetProximityNotificationRadius () (value int , ok bool )
GetReplyMarkup () (value ReplyMarkupClass , ok bool )
}) {
b .Geo = from .GetGeo ()
if val , ok := from .GetHeading (); ok {
b .Heading = val
}
if val , ok := from .GetPeriod (); ok {
b .Period = val
}
if val , ok := from .GetProximityNotificationRadius (); ok {
b .ProximityNotificationRadius = val
}
if val , ok := from .GetReplyMarkup (); ok {
b .ReplyMarkup = val
}
}
func (*BotInlineMessageMediaGeo ) TypeID () uint32 {
return BotInlineMessageMediaGeoTypeID
}
func (*BotInlineMessageMediaGeo ) TypeName () string {
return "botInlineMessageMediaGeo"
}
func (b *BotInlineMessageMediaGeo ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "botInlineMessageMediaGeo" ,
ID : BotInlineMessageMediaGeoTypeID ,
}
if b == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Geo" ,
SchemaName : "geo" ,
},
{
Name : "Heading" ,
SchemaName : "heading" ,
Null : !b .Flags .Has (0 ),
},
{
Name : "Period" ,
SchemaName : "period" ,
Null : !b .Flags .Has (1 ),
},
{
Name : "ProximityNotificationRadius" ,
SchemaName : "proximity_notification_radius" ,
Null : !b .Flags .Has (3 ),
},
{
Name : "ReplyMarkup" ,
SchemaName : "reply_markup" ,
Null : !b .Flags .Has (2 ),
},
}
return typ
}
func (b *BotInlineMessageMediaGeo ) SetFlags () {
if !(b .Heading == 0 ) {
b .Flags .Set (0 )
}
if !(b .Period == 0 ) {
b .Flags .Set (1 )
}
if !(b .ProximityNotificationRadius == 0 ) {
b .Flags .Set (3 )
}
if !(b .ReplyMarkup == nil ) {
b .Flags .Set (2 )
}
}
func (b *BotInlineMessageMediaGeo ) Encode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't encode botInlineMessageMediaGeo#51846fd as nil" )
}
buf .PutID (BotInlineMessageMediaGeoTypeID )
return b .EncodeBare (buf )
}
func (b *BotInlineMessageMediaGeo ) EncodeBare (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't encode botInlineMessageMediaGeo#51846fd as nil" )
}
b .SetFlags ()
if err := b .Flags .Encode (buf ); err != nil {
return fmt .Errorf ("unable to encode botInlineMessageMediaGeo#51846fd: field flags: %w" , err )
}
if b .Geo == nil {
return fmt .Errorf ("unable to encode botInlineMessageMediaGeo#51846fd: field geo is nil" )
}
if err := b .Geo .Encode (buf ); err != nil {
return fmt .Errorf ("unable to encode botInlineMessageMediaGeo#51846fd: field geo: %w" , err )
}
if b .Flags .Has (0 ) {
buf .PutInt (b .Heading )
}
if b .Flags .Has (1 ) {
buf .PutInt (b .Period )
}
if b .Flags .Has (3 ) {
buf .PutInt (b .ProximityNotificationRadius )
}
if b .Flags .Has (2 ) {
if b .ReplyMarkup == nil {
return fmt .Errorf ("unable to encode botInlineMessageMediaGeo#51846fd: field reply_markup is nil" )
}
if err := b .ReplyMarkup .Encode (buf ); err != nil {
return fmt .Errorf ("unable to encode botInlineMessageMediaGeo#51846fd: field reply_markup: %w" , err )
}
}
return nil
}
func (b *BotInlineMessageMediaGeo ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't decode botInlineMessageMediaGeo#51846fd to nil" )
}
if err := buf .ConsumeID (BotInlineMessageMediaGeoTypeID ); err != nil {
return fmt .Errorf ("unable to decode botInlineMessageMediaGeo#51846fd: %w" , err )
}
return b .DecodeBare (buf )
}
func (b *BotInlineMessageMediaGeo ) DecodeBare (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't decode botInlineMessageMediaGeo#51846fd to nil" )
}
{
if err := b .Flags .Decode (buf ); err != nil {
return fmt .Errorf ("unable to decode botInlineMessageMediaGeo#51846fd: field flags: %w" , err )
}
}
{
value , err := DecodeGeoPoint (buf )
if err != nil {
return fmt .Errorf ("unable to decode botInlineMessageMediaGeo#51846fd: field geo: %w" , err )
}
b .Geo = value
}
if b .Flags .Has (0 ) {
value , err := buf .Int ()
if err != nil {
return fmt .Errorf ("unable to decode botInlineMessageMediaGeo#51846fd: field heading: %w" , err )
}
b .Heading = value
}
if b .Flags .Has (1 ) {
value , err := buf .Int ()
if err != nil {
return fmt .Errorf ("unable to decode botInlineMessageMediaGeo#51846fd: field period: %w" , err )
}
b .Period = value
}
if b .Flags .Has (3 ) {
value , err := buf .Int ()
if err != nil {
return fmt .Errorf ("unable to decode botInlineMessageMediaGeo#51846fd: field proximity_notification_radius: %w" , err )
}
b .ProximityNotificationRadius = value
}
if b .Flags .Has (2 ) {
value , err := DecodeReplyMarkup (buf )
if err != nil {
return fmt .Errorf ("unable to decode botInlineMessageMediaGeo#51846fd: field reply_markup: %w" , err )
}
b .ReplyMarkup = value
}
return nil
}
func (b *BotInlineMessageMediaGeo ) GetGeo () (value GeoPointClass ) {
if b == nil {
return
}
return b .Geo
}
func (b *BotInlineMessageMediaGeo ) SetHeading (value int ) {
b .Flags .Set (0 )
b .Heading = value
}
func (b *BotInlineMessageMediaGeo ) GetHeading () (value int , ok bool ) {
if b == nil {
return
}
if !b .Flags .Has (0 ) {
return value , false
}
return b .Heading , true
}
func (b *BotInlineMessageMediaGeo ) SetPeriod (value int ) {
b .Flags .Set (1 )
b .Period = value
}
func (b *BotInlineMessageMediaGeo ) GetPeriod () (value int , ok bool ) {
if b == nil {
return
}
if !b .Flags .Has (1 ) {
return value , false
}
return b .Period , true
}
func (b *BotInlineMessageMediaGeo ) SetProximityNotificationRadius (value int ) {
b .Flags .Set (3 )
b .ProximityNotificationRadius = value
}
func (b *BotInlineMessageMediaGeo ) GetProximityNotificationRadius () (value int , ok bool ) {
if b == nil {
return
}
if !b .Flags .Has (3 ) {
return value , false
}
return b .ProximityNotificationRadius , true
}
func (b *BotInlineMessageMediaGeo ) SetReplyMarkup (value ReplyMarkupClass ) {
b .Flags .Set (2 )
b .ReplyMarkup = value
}
func (b *BotInlineMessageMediaGeo ) GetReplyMarkup () (value ReplyMarkupClass , ok bool ) {
if b == nil {
return
}
if !b .Flags .Has (2 ) {
return value , false
}
return b .ReplyMarkup , true
}
type BotInlineMessageMediaVenue struct {
Flags bin .Fields
Geo GeoPointClass
Title string
Address string
Provider string
VenueID string
VenueType string
ReplyMarkup ReplyMarkupClass
}
const BotInlineMessageMediaVenueTypeID = 0x8a86659c
func (b BotInlineMessageMediaVenue ) construct () BotInlineMessageClass { return &b }
var (
_ bin .Encoder = &BotInlineMessageMediaVenue {}
_ bin .Decoder = &BotInlineMessageMediaVenue {}
_ bin .BareEncoder = &BotInlineMessageMediaVenue {}
_ bin .BareDecoder = &BotInlineMessageMediaVenue {}
_ BotInlineMessageClass = &BotInlineMessageMediaVenue {}
)
func (b *BotInlineMessageMediaVenue ) Zero () bool {
if b == nil {
return true
}
if !(b .Flags .Zero ()) {
return false
}
if !(b .Geo == nil ) {
return false
}
if !(b .Title == "" ) {
return false
}
if !(b .Address == "" ) {
return false
}
if !(b .Provider == "" ) {
return false
}
if !(b .VenueID == "" ) {
return false
}
if !(b .VenueType == "" ) {
return false
}
if !(b .ReplyMarkup == nil ) {
return false
}
return true
}
func (b *BotInlineMessageMediaVenue ) String () string {
if b == nil {
return "BotInlineMessageMediaVenue(nil)"
}
type Alias BotInlineMessageMediaVenue
return fmt .Sprintf ("BotInlineMessageMediaVenue%+v" , Alias (*b ))
}
func (b *BotInlineMessageMediaVenue ) FillFrom (from interface {
GetGeo () (value GeoPointClass )
GetTitle () (value string )
GetAddress () (value string )
GetProvider () (value string )
GetVenueID () (value string )
GetVenueType () (value string )
GetReplyMarkup () (value ReplyMarkupClass , ok bool )
}) {
b .Geo = from .GetGeo ()
b .Title = from .GetTitle ()
b .Address = from .GetAddress ()
b .Provider = from .GetProvider ()
b .VenueID = from .GetVenueID ()
b .VenueType = from .GetVenueType ()
if val , ok := from .GetReplyMarkup (); ok {
b .ReplyMarkup = val
}
}
func (*BotInlineMessageMediaVenue ) TypeID () uint32 {
return BotInlineMessageMediaVenueTypeID
}
func (*BotInlineMessageMediaVenue ) TypeName () string {
return "botInlineMessageMediaVenue"
}
func (b *BotInlineMessageMediaVenue ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "botInlineMessageMediaVenue" ,
ID : BotInlineMessageMediaVenueTypeID ,
}
if b == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Geo" ,
SchemaName : "geo" ,
},
{
Name : "Title" ,
SchemaName : "title" ,
},
{
Name : "Address" ,
SchemaName : "address" ,
},
{
Name : "Provider" ,
SchemaName : "provider" ,
},
{
Name : "VenueID" ,
SchemaName : "venue_id" ,
},
{
Name : "VenueType" ,
SchemaName : "venue_type" ,
},
{
Name : "ReplyMarkup" ,
SchemaName : "reply_markup" ,
Null : !b .Flags .Has (2 ),
},
}
return typ
}
func (b *BotInlineMessageMediaVenue ) SetFlags () {
if !(b .ReplyMarkup == nil ) {
b .Flags .Set (2 )
}
}
func (b *BotInlineMessageMediaVenue ) Encode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't encode botInlineMessageMediaVenue#8a86659c as nil" )
}
buf .PutID (BotInlineMessageMediaVenueTypeID )
return b .EncodeBare (buf )
}
func (b *BotInlineMessageMediaVenue ) EncodeBare (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't encode botInlineMessageMediaVenue#8a86659c as nil" )
}
b .SetFlags ()
if err := b .Flags .Encode (buf ); err != nil {
return fmt .Errorf ("unable to encode botInlineMessageMediaVenue#8a86659c: field flags: %w" , err )
}
if b .Geo == nil {
return fmt .Errorf ("unable to encode botInlineMessageMediaVenue#8a86659c: field geo is nil" )
}
if err := b .Geo .Encode (buf ); err != nil {
return fmt .Errorf ("unable to encode botInlineMessageMediaVenue#8a86659c: field geo: %w" , err )
}
buf .PutString (b .Title )
buf .PutString (b .Address )
buf .PutString (b .Provider )
buf .PutString (b .VenueID )
buf .PutString (b .VenueType )
if b .Flags .Has (2 ) {
if b .ReplyMarkup == nil {
return fmt .Errorf ("unable to encode botInlineMessageMediaVenue#8a86659c: field reply_markup is nil" )
}
if err := b .ReplyMarkup .Encode (buf ); err != nil {
return fmt .Errorf ("unable to encode botInlineMessageMediaVenue#8a86659c: field reply_markup: %w" , err )
}
}
return nil
}
func (b *BotInlineMessageMediaVenue ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't decode botInlineMessageMediaVenue#8a86659c to nil" )
}
if err := buf .ConsumeID (BotInlineMessageMediaVenueTypeID ); err != nil {
return fmt .Errorf ("unable to decode botInlineMessageMediaVenue#8a86659c: %w" , err )
}
return b .DecodeBare (buf )
}
func (b *BotInlineMessageMediaVenue ) DecodeBare (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't decode botInlineMessageMediaVenue#8a86659c to nil" )
}
{
if err := b .Flags .Decode (buf ); err != nil {
return fmt .Errorf ("unable to decode botInlineMessageMediaVenue#8a86659c: field flags: %w" , err )
}
}
{
value , err := DecodeGeoPoint (buf )
if err != nil {
return fmt .Errorf ("unable to decode botInlineMessageMediaVenue#8a86659c: field geo: %w" , err )
}
b .Geo = value
}
{
value , err := buf .String ()
if err != nil {
return fmt .Errorf ("unable to decode botInlineMessageMediaVenue#8a86659c: field title: %w" , err )
}
b .Title = value
}
{
value , err := buf .String ()
if err != nil {
return fmt .Errorf ("unable to decode botInlineMessageMediaVenue#8a86659c: field address: %w" , err )
}
b .Address = value
}
{
value , err := buf .String ()
if err != nil {
return fmt .Errorf ("unable to decode botInlineMessageMediaVenue#8a86659c: field provider: %w" , err )
}
b .Provider = value
}
{
value , err := buf .String ()
if err != nil {
return fmt .Errorf ("unable to decode botInlineMessageMediaVenue#8a86659c: field venue_id: %w" , err )
}
b .VenueID = value
}
{
value , err := buf .String ()
if err != nil {
return fmt .Errorf ("unable to decode botInlineMessageMediaVenue#8a86659c: field venue_type: %w" , err )
}
b .VenueType = value
}
if b .Flags .Has (2 ) {
value , err := DecodeReplyMarkup (buf )
if err != nil {
return fmt .Errorf ("unable to decode botInlineMessageMediaVenue#8a86659c: field reply_markup: %w" , err )
}
b .ReplyMarkup = value
}
return nil
}
func (b *BotInlineMessageMediaVenue ) GetGeo () (value GeoPointClass ) {
if b == nil {
return
}
return b .Geo
}
func (b *BotInlineMessageMediaVenue ) GetTitle () (value string ) {
if b == nil {
return
}
return b .Title
}
func (b *BotInlineMessageMediaVenue ) GetAddress () (value string ) {
if b == nil {
return
}
return b .Address
}
func (b *BotInlineMessageMediaVenue ) GetProvider () (value string ) {
if b == nil {
return
}
return b .Provider
}
func (b *BotInlineMessageMediaVenue ) GetVenueID () (value string ) {
if b == nil {
return
}
return b .VenueID
}
func (b *BotInlineMessageMediaVenue ) GetVenueType () (value string ) {
if b == nil {
return
}
return b .VenueType
}
func (b *BotInlineMessageMediaVenue ) SetReplyMarkup (value ReplyMarkupClass ) {
b .Flags .Set (2 )
b .ReplyMarkup = value
}
func (b *BotInlineMessageMediaVenue ) GetReplyMarkup () (value ReplyMarkupClass , ok bool ) {
if b == nil {
return
}
if !b .Flags .Has (2 ) {
return value , false
}
return b .ReplyMarkup , true
}
type BotInlineMessageMediaContact struct {
Flags bin .Fields
PhoneNumber string
FirstName string
LastName string
Vcard string
ReplyMarkup ReplyMarkupClass
}
const BotInlineMessageMediaContactTypeID = 0x18d1cdc2
func (b BotInlineMessageMediaContact ) construct () BotInlineMessageClass { return &b }
var (
_ bin .Encoder = &BotInlineMessageMediaContact {}
_ bin .Decoder = &BotInlineMessageMediaContact {}
_ bin .BareEncoder = &BotInlineMessageMediaContact {}
_ bin .BareDecoder = &BotInlineMessageMediaContact {}
_ BotInlineMessageClass = &BotInlineMessageMediaContact {}
)
func (b *BotInlineMessageMediaContact ) Zero () bool {
if b == nil {
return true
}
if !(b .Flags .Zero ()) {
return false
}
if !(b .PhoneNumber == "" ) {
return false
}
if !(b .FirstName == "" ) {
return false
}
if !(b .LastName == "" ) {
return false
}
if !(b .Vcard == "" ) {
return false
}
if !(b .ReplyMarkup == nil ) {
return false
}
return true
}
func (b *BotInlineMessageMediaContact ) String () string {
if b == nil {
return "BotInlineMessageMediaContact(nil)"
}
type Alias BotInlineMessageMediaContact
return fmt .Sprintf ("BotInlineMessageMediaContact%+v" , Alias (*b ))
}
func (b *BotInlineMessageMediaContact ) FillFrom (from interface {
GetPhoneNumber () (value string )
GetFirstName () (value string )
GetLastName () (value string )
GetVcard () (value string )
GetReplyMarkup () (value ReplyMarkupClass , ok bool )
}) {
b .PhoneNumber = from .GetPhoneNumber ()
b .FirstName = from .GetFirstName ()
b .LastName = from .GetLastName ()
b .Vcard = from .GetVcard ()
if val , ok := from .GetReplyMarkup (); ok {
b .ReplyMarkup = val
}
}
func (*BotInlineMessageMediaContact ) TypeID () uint32 {
return BotInlineMessageMediaContactTypeID
}
func (*BotInlineMessageMediaContact ) TypeName () string {
return "botInlineMessageMediaContact"
}
func (b *BotInlineMessageMediaContact ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "botInlineMessageMediaContact" ,
ID : BotInlineMessageMediaContactTypeID ,
}
if b == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "PhoneNumber" ,
SchemaName : "phone_number" ,
},
{
Name : "FirstName" ,
SchemaName : "first_name" ,
},
{
Name : "LastName" ,
SchemaName : "last_name" ,
},
{
Name : "Vcard" ,
SchemaName : "vcard" ,
},
{
Name : "ReplyMarkup" ,
SchemaName : "reply_markup" ,
Null : !b .Flags .Has (2 ),
},
}
return typ
}
func (b *BotInlineMessageMediaContact ) SetFlags () {
if !(b .ReplyMarkup == nil ) {
b .Flags .Set (2 )
}
}
func (b *BotInlineMessageMediaContact ) Encode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't encode botInlineMessageMediaContact#18d1cdc2 as nil" )
}
buf .PutID (BotInlineMessageMediaContactTypeID )
return b .EncodeBare (buf )
}
func (b *BotInlineMessageMediaContact ) EncodeBare (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't encode botInlineMessageMediaContact#18d1cdc2 as nil" )
}
b .SetFlags ()
if err := b .Flags .Encode (buf ); err != nil {
return fmt .Errorf ("unable to encode botInlineMessageMediaContact#18d1cdc2: field flags: %w" , err )
}
buf .PutString (b .PhoneNumber )
buf .PutString (b .FirstName )
buf .PutString (b .LastName )
buf .PutString (b .Vcard )
if b .Flags .Has (2 ) {
if b .ReplyMarkup == nil {
return fmt .Errorf ("unable to encode botInlineMessageMediaContact#18d1cdc2: field reply_markup is nil" )
}
if err := b .ReplyMarkup .Encode (buf ); err != nil {
return fmt .Errorf ("unable to encode botInlineMessageMediaContact#18d1cdc2: field reply_markup: %w" , err )
}
}
return nil
}
func (b *BotInlineMessageMediaContact ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't decode botInlineMessageMediaContact#18d1cdc2 to nil" )
}
if err := buf .ConsumeID (BotInlineMessageMediaContactTypeID ); err != nil {
return fmt .Errorf ("unable to decode botInlineMessageMediaContact#18d1cdc2: %w" , err )
}
return b .DecodeBare (buf )
}
func (b *BotInlineMessageMediaContact ) DecodeBare (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't decode botInlineMessageMediaContact#18d1cdc2 to nil" )
}
{
if err := b .Flags .Decode (buf ); err != nil {
return fmt .Errorf ("unable to decode botInlineMessageMediaContact#18d1cdc2: field flags: %w" , err )
}
}
{
value , err := buf .String ()
if err != nil {
return fmt .Errorf ("unable to decode botInlineMessageMediaContact#18d1cdc2: field phone_number: %w" , err )
}
b .PhoneNumber = value
}
{
value , err := buf .String ()
if err != nil {
return fmt .Errorf ("unable to decode botInlineMessageMediaContact#18d1cdc2: field first_name: %w" , err )
}
b .FirstName = value
}
{
value , err := buf .String ()
if err != nil {
return fmt .Errorf ("unable to decode botInlineMessageMediaContact#18d1cdc2: field last_name: %w" , err )
}
b .LastName = value
}
{
value , err := buf .String ()
if err != nil {
return fmt .Errorf ("unable to decode botInlineMessageMediaContact#18d1cdc2: field vcard: %w" , err )
}
b .Vcard = value
}
if b .Flags .Has (2 ) {
value , err := DecodeReplyMarkup (buf )
if err != nil {
return fmt .Errorf ("unable to decode botInlineMessageMediaContact#18d1cdc2: field reply_markup: %w" , err )
}
b .ReplyMarkup = value
}
return nil
}
func (b *BotInlineMessageMediaContact ) GetPhoneNumber () (value string ) {
if b == nil {
return
}
return b .PhoneNumber
}
func (b *BotInlineMessageMediaContact ) GetFirstName () (value string ) {
if b == nil {
return
}
return b .FirstName
}
func (b *BotInlineMessageMediaContact ) GetLastName () (value string ) {
if b == nil {
return
}
return b .LastName
}
func (b *BotInlineMessageMediaContact ) GetVcard () (value string ) {
if b == nil {
return
}
return b .Vcard
}
func (b *BotInlineMessageMediaContact ) SetReplyMarkup (value ReplyMarkupClass ) {
b .Flags .Set (2 )
b .ReplyMarkup = value
}
func (b *BotInlineMessageMediaContact ) GetReplyMarkup () (value ReplyMarkupClass , ok bool ) {
if b == nil {
return
}
if !b .Flags .Has (2 ) {
return value , false
}
return b .ReplyMarkup , true
}
type BotInlineMessageMediaInvoice struct {
Flags bin .Fields
ShippingAddressRequested bool
Test bool
Title string
Description string
Photo WebDocumentClass
Currency string
TotalAmount int64
ReplyMarkup ReplyMarkupClass
}
const BotInlineMessageMediaInvoiceTypeID = 0x354a9b09
func (b BotInlineMessageMediaInvoice ) construct () BotInlineMessageClass { return &b }
var (
_ bin .Encoder = &BotInlineMessageMediaInvoice {}
_ bin .Decoder = &BotInlineMessageMediaInvoice {}
_ bin .BareEncoder = &BotInlineMessageMediaInvoice {}
_ bin .BareDecoder = &BotInlineMessageMediaInvoice {}
_ BotInlineMessageClass = &BotInlineMessageMediaInvoice {}
)
func (b *BotInlineMessageMediaInvoice ) Zero () bool {
if b == nil {
return true
}
if !(b .Flags .Zero ()) {
return false
}
if !(b .ShippingAddressRequested == false ) {
return false
}
if !(b .Test == false ) {
return false
}
if !(b .Title == "" ) {
return false
}
if !(b .Description == "" ) {
return false
}
if !(b .Photo == nil ) {
return false
}
if !(b .Currency == "" ) {
return false
}
if !(b .TotalAmount == 0 ) {
return false
}
if !(b .ReplyMarkup == nil ) {
return false
}
return true
}
func (b *BotInlineMessageMediaInvoice ) String () string {
if b == nil {
return "BotInlineMessageMediaInvoice(nil)"
}
type Alias BotInlineMessageMediaInvoice
return fmt .Sprintf ("BotInlineMessageMediaInvoice%+v" , Alias (*b ))
}
func (b *BotInlineMessageMediaInvoice ) FillFrom (from interface {
GetShippingAddressRequested () (value bool )
GetTest () (value bool )
GetTitle () (value string )
GetDescription () (value string )
GetPhoto () (value WebDocumentClass , ok bool )
GetCurrency () (value string )
GetTotalAmount () (value int64 )
GetReplyMarkup () (value ReplyMarkupClass , ok bool )
}) {
b .ShippingAddressRequested = from .GetShippingAddressRequested ()
b .Test = from .GetTest ()
b .Title = from .GetTitle ()
b .Description = from .GetDescription ()
if val , ok := from .GetPhoto (); ok {
b .Photo = val
}
b .Currency = from .GetCurrency ()
b .TotalAmount = from .GetTotalAmount ()
if val , ok := from .GetReplyMarkup (); ok {
b .ReplyMarkup = val
}
}
func (*BotInlineMessageMediaInvoice ) TypeID () uint32 {
return BotInlineMessageMediaInvoiceTypeID
}
func (*BotInlineMessageMediaInvoice ) TypeName () string {
return "botInlineMessageMediaInvoice"
}
func (b *BotInlineMessageMediaInvoice ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "botInlineMessageMediaInvoice" ,
ID : BotInlineMessageMediaInvoiceTypeID ,
}
if b == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "ShippingAddressRequested" ,
SchemaName : "shipping_address_requested" ,
Null : !b .Flags .Has (1 ),
},
{
Name : "Test" ,
SchemaName : "test" ,
Null : !b .Flags .Has (3 ),
},
{
Name : "Title" ,
SchemaName : "title" ,
},
{
Name : "Description" ,
SchemaName : "description" ,
},
{
Name : "Photo" ,
SchemaName : "photo" ,
Null : !b .Flags .Has (0 ),
},
{
Name : "Currency" ,
SchemaName : "currency" ,
},
{
Name : "TotalAmount" ,
SchemaName : "total_amount" ,
},
{
Name : "ReplyMarkup" ,
SchemaName : "reply_markup" ,
Null : !b .Flags .Has (2 ),
},
}
return typ
}
func (b *BotInlineMessageMediaInvoice ) SetFlags () {
if !(b .ShippingAddressRequested == false ) {
b .Flags .Set (1 )
}
if !(b .Test == false ) {
b .Flags .Set (3 )
}
if !(b .Photo == nil ) {
b .Flags .Set (0 )
}
if !(b .ReplyMarkup == nil ) {
b .Flags .Set (2 )
}
}
func (b *BotInlineMessageMediaInvoice ) Encode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't encode botInlineMessageMediaInvoice#354a9b09 as nil" )
}
buf .PutID (BotInlineMessageMediaInvoiceTypeID )
return b .EncodeBare (buf )
}
func (b *BotInlineMessageMediaInvoice ) EncodeBare (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't encode botInlineMessageMediaInvoice#354a9b09 as nil" )
}
b .SetFlags ()
if err := b .Flags .Encode (buf ); err != nil {
return fmt .Errorf ("unable to encode botInlineMessageMediaInvoice#354a9b09: field flags: %w" , err )
}
buf .PutString (b .Title )
buf .PutString (b .Description )
if b .Flags .Has (0 ) {
if b .Photo == nil {
return fmt .Errorf ("unable to encode botInlineMessageMediaInvoice#354a9b09: field photo is nil" )
}
if err := b .Photo .Encode (buf ); err != nil {
return fmt .Errorf ("unable to encode botInlineMessageMediaInvoice#354a9b09: field photo: %w" , err )
}
}
buf .PutString (b .Currency )
buf .PutLong (b .TotalAmount )
if b .Flags .Has (2 ) {
if b .ReplyMarkup == nil {
return fmt .Errorf ("unable to encode botInlineMessageMediaInvoice#354a9b09: field reply_markup is nil" )
}
if err := b .ReplyMarkup .Encode (buf ); err != nil {
return fmt .Errorf ("unable to encode botInlineMessageMediaInvoice#354a9b09: field reply_markup: %w" , err )
}
}
return nil
}
func (b *BotInlineMessageMediaInvoice ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't decode botInlineMessageMediaInvoice#354a9b09 to nil" )
}
if err := buf .ConsumeID (BotInlineMessageMediaInvoiceTypeID ); err != nil {
return fmt .Errorf ("unable to decode botInlineMessageMediaInvoice#354a9b09: %w" , err )
}
return b .DecodeBare (buf )
}
func (b *BotInlineMessageMediaInvoice ) DecodeBare (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't decode botInlineMessageMediaInvoice#354a9b09 to nil" )
}
{
if err := b .Flags .Decode (buf ); err != nil {
return fmt .Errorf ("unable to decode botInlineMessageMediaInvoice#354a9b09: field flags: %w" , err )
}
}
b .ShippingAddressRequested = b .Flags .Has (1 )
b .Test = b .Flags .Has (3 )
{
value , err := buf .String ()
if err != nil {
return fmt .Errorf ("unable to decode botInlineMessageMediaInvoice#354a9b09: field title: %w" , err )
}
b .Title = value
}
{
value , err := buf .String ()
if err != nil {
return fmt .Errorf ("unable to decode botInlineMessageMediaInvoice#354a9b09: field description: %w" , err )
}
b .Description = value
}
if b .Flags .Has (0 ) {
value , err := DecodeWebDocument (buf )
if err != nil {
return fmt .Errorf ("unable to decode botInlineMessageMediaInvoice#354a9b09: field photo: %w" , err )
}
b .Photo = value
}
{
value , err := buf .String ()
if err != nil {
return fmt .Errorf ("unable to decode botInlineMessageMediaInvoice#354a9b09: field currency: %w" , err )
}
b .Currency = value
}
{
value , err := buf .Long ()
if err != nil {
return fmt .Errorf ("unable to decode botInlineMessageMediaInvoice#354a9b09: field total_amount: %w" , err )
}
b .TotalAmount = value
}
if b .Flags .Has (2 ) {
value , err := DecodeReplyMarkup (buf )
if err != nil {
return fmt .Errorf ("unable to decode botInlineMessageMediaInvoice#354a9b09: field reply_markup: %w" , err )
}
b .ReplyMarkup = value
}
return nil
}
func (b *BotInlineMessageMediaInvoice ) SetShippingAddressRequested (value bool ) {
if value {
b .Flags .Set (1 )
b .ShippingAddressRequested = true
} else {
b .Flags .Unset (1 )
b .ShippingAddressRequested = false
}
}
func (b *BotInlineMessageMediaInvoice ) GetShippingAddressRequested () (value bool ) {
if b == nil {
return
}
return b .Flags .Has (1 )
}
func (b *BotInlineMessageMediaInvoice ) SetTest (value bool ) {
if value {
b .Flags .Set (3 )
b .Test = true
} else {
b .Flags .Unset (3 )
b .Test = false
}
}
func (b *BotInlineMessageMediaInvoice ) GetTest () (value bool ) {
if b == nil {
return
}
return b .Flags .Has (3 )
}
func (b *BotInlineMessageMediaInvoice ) GetTitle () (value string ) {
if b == nil {
return
}
return b .Title
}
func (b *BotInlineMessageMediaInvoice ) GetDescription () (value string ) {
if b == nil {
return
}
return b .Description
}
func (b *BotInlineMessageMediaInvoice ) SetPhoto (value WebDocumentClass ) {
b .Flags .Set (0 )
b .Photo = value
}
func (b *BotInlineMessageMediaInvoice ) GetPhoto () (value WebDocumentClass , ok bool ) {
if b == nil {
return
}
if !b .Flags .Has (0 ) {
return value , false
}
return b .Photo , true
}
func (b *BotInlineMessageMediaInvoice ) GetCurrency () (value string ) {
if b == nil {
return
}
return b .Currency
}
func (b *BotInlineMessageMediaInvoice ) GetTotalAmount () (value int64 ) {
if b == nil {
return
}
return b .TotalAmount
}
func (b *BotInlineMessageMediaInvoice ) SetReplyMarkup (value ReplyMarkupClass ) {
b .Flags .Set (2 )
b .ReplyMarkup = value
}
func (b *BotInlineMessageMediaInvoice ) GetReplyMarkup () (value ReplyMarkupClass , ok bool ) {
if b == nil {
return
}
if !b .Flags .Has (2 ) {
return value , false
}
return b .ReplyMarkup , true
}
type BotInlineMessageMediaWebPage struct {
Flags bin .Fields
InvertMedia bool
ForceLargeMedia bool
ForceSmallMedia bool
Manual bool
Safe bool
Message string
Entities []MessageEntityClass
URL string
ReplyMarkup ReplyMarkupClass
}
const BotInlineMessageMediaWebPageTypeID = 0x809ad9a6
func (b BotInlineMessageMediaWebPage ) construct () BotInlineMessageClass { return &b }
var (
_ bin .Encoder = &BotInlineMessageMediaWebPage {}
_ bin .Decoder = &BotInlineMessageMediaWebPage {}
_ bin .BareEncoder = &BotInlineMessageMediaWebPage {}
_ bin .BareDecoder = &BotInlineMessageMediaWebPage {}
_ BotInlineMessageClass = &BotInlineMessageMediaWebPage {}
)
func (b *BotInlineMessageMediaWebPage ) Zero () bool {
if b == nil {
return true
}
if !(b .Flags .Zero ()) {
return false
}
if !(b .InvertMedia == false ) {
return false
}
if !(b .ForceLargeMedia == false ) {
return false
}
if !(b .ForceSmallMedia == false ) {
return false
}
if !(b .Manual == false ) {
return false
}
if !(b .Safe == false ) {
return false
}
if !(b .Message == "" ) {
return false
}
if !(b .Entities == nil ) {
return false
}
if !(b .URL == "" ) {
return false
}
if !(b .ReplyMarkup == nil ) {
return false
}
return true
}
func (b *BotInlineMessageMediaWebPage ) String () string {
if b == nil {
return "BotInlineMessageMediaWebPage(nil)"
}
type Alias BotInlineMessageMediaWebPage
return fmt .Sprintf ("BotInlineMessageMediaWebPage%+v" , Alias (*b ))
}
func (b *BotInlineMessageMediaWebPage ) FillFrom (from interface {
GetInvertMedia () (value bool )
GetForceLargeMedia () (value bool )
GetForceSmallMedia () (value bool )
GetManual () (value bool )
GetSafe () (value bool )
GetMessage () (value string )
GetEntities () (value []MessageEntityClass , ok bool )
GetURL () (value string )
GetReplyMarkup () (value ReplyMarkupClass , ok bool )
}) {
b .InvertMedia = from .GetInvertMedia ()
b .ForceLargeMedia = from .GetForceLargeMedia ()
b .ForceSmallMedia = from .GetForceSmallMedia ()
b .Manual = from .GetManual ()
b .Safe = from .GetSafe ()
b .Message = from .GetMessage ()
if val , ok := from .GetEntities (); ok {
b .Entities = val
}
b .URL = from .GetURL ()
if val , ok := from .GetReplyMarkup (); ok {
b .ReplyMarkup = val
}
}
func (*BotInlineMessageMediaWebPage ) TypeID () uint32 {
return BotInlineMessageMediaWebPageTypeID
}
func (*BotInlineMessageMediaWebPage ) TypeName () string {
return "botInlineMessageMediaWebPage"
}
func (b *BotInlineMessageMediaWebPage ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "botInlineMessageMediaWebPage" ,
ID : BotInlineMessageMediaWebPageTypeID ,
}
if b == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "InvertMedia" ,
SchemaName : "invert_media" ,
Null : !b .Flags .Has (3 ),
},
{
Name : "ForceLargeMedia" ,
SchemaName : "force_large_media" ,
Null : !b .Flags .Has (4 ),
},
{
Name : "ForceSmallMedia" ,
SchemaName : "force_small_media" ,
Null : !b .Flags .Has (5 ),
},
{
Name : "Manual" ,
SchemaName : "manual" ,
Null : !b .Flags .Has (7 ),
},
{
Name : "Safe" ,
SchemaName : "safe" ,
Null : !b .Flags .Has (8 ),
},
{
Name : "Message" ,
SchemaName : "message" ,
},
{
Name : "Entities" ,
SchemaName : "entities" ,
Null : !b .Flags .Has (1 ),
},
{
Name : "URL" ,
SchemaName : "url" ,
},
{
Name : "ReplyMarkup" ,
SchemaName : "reply_markup" ,
Null : !b .Flags .Has (2 ),
},
}
return typ
}
func (b *BotInlineMessageMediaWebPage ) SetFlags () {
if !(b .InvertMedia == false ) {
b .Flags .Set (3 )
}
if !(b .ForceLargeMedia == false ) {
b .Flags .Set (4 )
}
if !(b .ForceSmallMedia == false ) {
b .Flags .Set (5 )
}
if !(b .Manual == false ) {
b .Flags .Set (7 )
}
if !(b .Safe == false ) {
b .Flags .Set (8 )
}
if !(b .Entities == nil ) {
b .Flags .Set (1 )
}
if !(b .ReplyMarkup == nil ) {
b .Flags .Set (2 )
}
}
func (b *BotInlineMessageMediaWebPage ) Encode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't encode botInlineMessageMediaWebPage#809ad9a6 as nil" )
}
buf .PutID (BotInlineMessageMediaWebPageTypeID )
return b .EncodeBare (buf )
}
func (b *BotInlineMessageMediaWebPage ) EncodeBare (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't encode botInlineMessageMediaWebPage#809ad9a6 as nil" )
}
b .SetFlags ()
if err := b .Flags .Encode (buf ); err != nil {
return fmt .Errorf ("unable to encode botInlineMessageMediaWebPage#809ad9a6: field flags: %w" , err )
}
buf .PutString (b .Message )
if b .Flags .Has (1 ) {
buf .PutVectorHeader (len (b .Entities ))
for idx , v := range b .Entities {
if v == nil {
return fmt .Errorf ("unable to encode botInlineMessageMediaWebPage#809ad9a6: field entities element with index %d is nil" , idx )
}
if err := v .Encode (buf ); err != nil {
return fmt .Errorf ("unable to encode botInlineMessageMediaWebPage#809ad9a6: field entities element with index %d: %w" , idx , err )
}
}
}
buf .PutString (b .URL )
if b .Flags .Has (2 ) {
if b .ReplyMarkup == nil {
return fmt .Errorf ("unable to encode botInlineMessageMediaWebPage#809ad9a6: field reply_markup is nil" )
}
if err := b .ReplyMarkup .Encode (buf ); err != nil {
return fmt .Errorf ("unable to encode botInlineMessageMediaWebPage#809ad9a6: field reply_markup: %w" , err )
}
}
return nil
}
func (b *BotInlineMessageMediaWebPage ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't decode botInlineMessageMediaWebPage#809ad9a6 to nil" )
}
if err := buf .ConsumeID (BotInlineMessageMediaWebPageTypeID ); err != nil {
return fmt .Errorf ("unable to decode botInlineMessageMediaWebPage#809ad9a6: %w" , err )
}
return b .DecodeBare (buf )
}
func (b *BotInlineMessageMediaWebPage ) DecodeBare (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't decode botInlineMessageMediaWebPage#809ad9a6 to nil" )
}
{
if err := b .Flags .Decode (buf ); err != nil {
return fmt .Errorf ("unable to decode botInlineMessageMediaWebPage#809ad9a6: field flags: %w" , err )
}
}
b .InvertMedia = b .Flags .Has (3 )
b .ForceLargeMedia = b .Flags .Has (4 )
b .ForceSmallMedia = b .Flags .Has (5 )
b .Manual = b .Flags .Has (7 )
b .Safe = b .Flags .Has (8 )
{
value , err := buf .String ()
if err != nil {
return fmt .Errorf ("unable to decode botInlineMessageMediaWebPage#809ad9a6: field message: %w" , err )
}
b .Message = value
}
if b .Flags .Has (1 ) {
headerLen , err := buf .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode botInlineMessageMediaWebPage#809ad9a6: field entities: %w" , err )
}
if headerLen > 0 {
b .Entities = make ([]MessageEntityClass , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
value , err := DecodeMessageEntity (buf )
if err != nil {
return fmt .Errorf ("unable to decode botInlineMessageMediaWebPage#809ad9a6: field entities: %w" , err )
}
b .Entities = append (b .Entities , value )
}
}
{
value , err := buf .String ()
if err != nil {
return fmt .Errorf ("unable to decode botInlineMessageMediaWebPage#809ad9a6: field url: %w" , err )
}
b .URL = value
}
if b .Flags .Has (2 ) {
value , err := DecodeReplyMarkup (buf )
if err != nil {
return fmt .Errorf ("unable to decode botInlineMessageMediaWebPage#809ad9a6: field reply_markup: %w" , err )
}
b .ReplyMarkup = value
}
return nil
}
func (b *BotInlineMessageMediaWebPage ) SetInvertMedia (value bool ) {
if value {
b .Flags .Set (3 )
b .InvertMedia = true
} else {
b .Flags .Unset (3 )
b .InvertMedia = false
}
}
func (b *BotInlineMessageMediaWebPage ) GetInvertMedia () (value bool ) {
if b == nil {
return
}
return b .Flags .Has (3 )
}
func (b *BotInlineMessageMediaWebPage ) SetForceLargeMedia (value bool ) {
if value {
b .Flags .Set (4 )
b .ForceLargeMedia = true
} else {
b .Flags .Unset (4 )
b .ForceLargeMedia = false
}
}
func (b *BotInlineMessageMediaWebPage ) GetForceLargeMedia () (value bool ) {
if b == nil {
return
}
return b .Flags .Has (4 )
}
func (b *BotInlineMessageMediaWebPage ) SetForceSmallMedia (value bool ) {
if value {
b .Flags .Set (5 )
b .ForceSmallMedia = true
} else {
b .Flags .Unset (5 )
b .ForceSmallMedia = false
}
}
func (b *BotInlineMessageMediaWebPage ) GetForceSmallMedia () (value bool ) {
if b == nil {
return
}
return b .Flags .Has (5 )
}
func (b *BotInlineMessageMediaWebPage ) SetManual (value bool ) {
if value {
b .Flags .Set (7 )
b .Manual = true
} else {
b .Flags .Unset (7 )
b .Manual = false
}
}
func (b *BotInlineMessageMediaWebPage ) GetManual () (value bool ) {
if b == nil {
return
}
return b .Flags .Has (7 )
}
func (b *BotInlineMessageMediaWebPage ) SetSafe (value bool ) {
if value {
b .Flags .Set (8 )
b .Safe = true
} else {
b .Flags .Unset (8 )
b .Safe = false
}
}
func (b *BotInlineMessageMediaWebPage ) GetSafe () (value bool ) {
if b == nil {
return
}
return b .Flags .Has (8 )
}
func (b *BotInlineMessageMediaWebPage ) GetMessage () (value string ) {
if b == nil {
return
}
return b .Message
}
func (b *BotInlineMessageMediaWebPage ) SetEntities (value []MessageEntityClass ) {
b .Flags .Set (1 )
b .Entities = value
}
func (b *BotInlineMessageMediaWebPage ) GetEntities () (value []MessageEntityClass , ok bool ) {
if b == nil {
return
}
if !b .Flags .Has (1 ) {
return value , false
}
return b .Entities , true
}
func (b *BotInlineMessageMediaWebPage ) GetURL () (value string ) {
if b == nil {
return
}
return b .URL
}
func (b *BotInlineMessageMediaWebPage ) SetReplyMarkup (value ReplyMarkupClass ) {
b .Flags .Set (2 )
b .ReplyMarkup = value
}
func (b *BotInlineMessageMediaWebPage ) GetReplyMarkup () (value ReplyMarkupClass , ok bool ) {
if b == nil {
return
}
if !b .Flags .Has (2 ) {
return value , false
}
return b .ReplyMarkup , true
}
func (b *BotInlineMessageMediaWebPage ) MapEntities () (value MessageEntityClassArray , ok bool ) {
if !b .Flags .Has (1 ) {
return value , false
}
return MessageEntityClassArray (b .Entities ), true
}
const BotInlineMessageClassName = "BotInlineMessage"
type BotInlineMessageClass interface {
bin .Encoder
bin .Decoder
bin .BareEncoder
bin .BareDecoder
construct () BotInlineMessageClass
TypeID () uint32
TypeName () string
String () string
Zero () bool
GetReplyMarkup () (value ReplyMarkupClass , ok bool )
}
func DecodeBotInlineMessage (buf *bin .Buffer ) (BotInlineMessageClass , error ) {
id , err := buf .PeekID ()
if err != nil {
return nil , err
}
switch id {
case BotInlineMessageMediaAutoTypeID :
v := BotInlineMessageMediaAuto {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode BotInlineMessageClass: %w" , err )
}
return &v , nil
case BotInlineMessageTextTypeID :
v := BotInlineMessageText {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode BotInlineMessageClass: %w" , err )
}
return &v , nil
case BotInlineMessageMediaGeoTypeID :
v := BotInlineMessageMediaGeo {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode BotInlineMessageClass: %w" , err )
}
return &v , nil
case BotInlineMessageMediaVenueTypeID :
v := BotInlineMessageMediaVenue {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode BotInlineMessageClass: %w" , err )
}
return &v , nil
case BotInlineMessageMediaContactTypeID :
v := BotInlineMessageMediaContact {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode BotInlineMessageClass: %w" , err )
}
return &v , nil
case BotInlineMessageMediaInvoiceTypeID :
v := BotInlineMessageMediaInvoice {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode BotInlineMessageClass: %w" , err )
}
return &v , nil
case BotInlineMessageMediaWebPageTypeID :
v := BotInlineMessageMediaWebPage {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode BotInlineMessageClass: %w" , err )
}
return &v , nil
default :
return nil , fmt .Errorf ("unable to decode BotInlineMessageClass: %w" , bin .NewUnexpectedID (id ))
}
}
type BotInlineMessageBox struct {
BotInlineMessage BotInlineMessageClass
}
func (b *BotInlineMessageBox ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("unable to decode BotInlineMessageBox to nil" )
}
v , err := DecodeBotInlineMessage (buf )
if err != nil {
return fmt .Errorf ("unable to decode boxed value: %w" , err )
}
b .BotInlineMessage = v
return nil
}
func (b *BotInlineMessageBox ) Encode (buf *bin .Buffer ) error {
if b == nil || b .BotInlineMessage == nil {
return fmt .Errorf ("unable to encode BotInlineMessageClass as nil" )
}
return b .BotInlineMessage .Encode (buf )
}
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 .