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 MessageMediaEmpty struct {
}
const MessageMediaEmptyTypeID = 0x3ded6320
func (m MessageMediaEmpty ) construct () MessageMediaClass { return &m }
var (
_ bin .Encoder = &MessageMediaEmpty {}
_ bin .Decoder = &MessageMediaEmpty {}
_ bin .BareEncoder = &MessageMediaEmpty {}
_ bin .BareDecoder = &MessageMediaEmpty {}
_ MessageMediaClass = &MessageMediaEmpty {}
)
func (m *MessageMediaEmpty ) Zero () bool {
if m == nil {
return true
}
return true
}
func (m *MessageMediaEmpty ) String () string {
if m == nil {
return "MessageMediaEmpty(nil)"
}
type Alias MessageMediaEmpty
return fmt .Sprintf ("MessageMediaEmpty%+v" , Alias (*m ))
}
func (*MessageMediaEmpty ) TypeID () uint32 {
return MessageMediaEmptyTypeID
}
func (*MessageMediaEmpty ) TypeName () string {
return "messageMediaEmpty"
}
func (m *MessageMediaEmpty ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messageMediaEmpty" ,
ID : MessageMediaEmptyTypeID ,
}
if m == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {}
return typ
}
func (m *MessageMediaEmpty ) Encode (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't encode messageMediaEmpty#3ded6320 as nil" )
}
b .PutID (MessageMediaEmptyTypeID )
return m .EncodeBare (b )
}
func (m *MessageMediaEmpty ) EncodeBare (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't encode messageMediaEmpty#3ded6320 as nil" )
}
return nil
}
func (m *MessageMediaEmpty ) Decode (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't decode messageMediaEmpty#3ded6320 to nil" )
}
if err := b .ConsumeID (MessageMediaEmptyTypeID ); err != nil {
return fmt .Errorf ("unable to decode messageMediaEmpty#3ded6320: %w" , err )
}
return m .DecodeBare (b )
}
func (m *MessageMediaEmpty ) DecodeBare (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't decode messageMediaEmpty#3ded6320 to nil" )
}
return nil
}
type MessageMediaPhoto struct {
Flags bin .Fields
Spoiler bool
Photo PhotoClass
TTLSeconds int
}
const MessageMediaPhotoTypeID = 0x695150d7
func (m MessageMediaPhoto ) construct () MessageMediaClass { return &m }
var (
_ bin .Encoder = &MessageMediaPhoto {}
_ bin .Decoder = &MessageMediaPhoto {}
_ bin .BareEncoder = &MessageMediaPhoto {}
_ bin .BareDecoder = &MessageMediaPhoto {}
_ MessageMediaClass = &MessageMediaPhoto {}
)
func (m *MessageMediaPhoto ) Zero () bool {
if m == nil {
return true
}
if !(m .Flags .Zero ()) {
return false
}
if !(m .Spoiler == false ) {
return false
}
if !(m .Photo == nil ) {
return false
}
if !(m .TTLSeconds == 0 ) {
return false
}
return true
}
func (m *MessageMediaPhoto ) String () string {
if m == nil {
return "MessageMediaPhoto(nil)"
}
type Alias MessageMediaPhoto
return fmt .Sprintf ("MessageMediaPhoto%+v" , Alias (*m ))
}
func (m *MessageMediaPhoto ) FillFrom (from interface {
GetSpoiler () (value bool )
GetPhoto () (value PhotoClass , ok bool )
GetTTLSeconds () (value int , ok bool )
}) {
m .Spoiler = from .GetSpoiler ()
if val , ok := from .GetPhoto (); ok {
m .Photo = val
}
if val , ok := from .GetTTLSeconds (); ok {
m .TTLSeconds = val
}
}
func (*MessageMediaPhoto ) TypeID () uint32 {
return MessageMediaPhotoTypeID
}
func (*MessageMediaPhoto ) TypeName () string {
return "messageMediaPhoto"
}
func (m *MessageMediaPhoto ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messageMediaPhoto" ,
ID : MessageMediaPhotoTypeID ,
}
if m == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Spoiler" ,
SchemaName : "spoiler" ,
Null : !m .Flags .Has (3 ),
},
{
Name : "Photo" ,
SchemaName : "photo" ,
Null : !m .Flags .Has (0 ),
},
{
Name : "TTLSeconds" ,
SchemaName : "ttl_seconds" ,
Null : !m .Flags .Has (2 ),
},
}
return typ
}
func (m *MessageMediaPhoto ) SetFlags () {
if !(m .Spoiler == false ) {
m .Flags .Set (3 )
}
if !(m .Photo == nil ) {
m .Flags .Set (0 )
}
if !(m .TTLSeconds == 0 ) {
m .Flags .Set (2 )
}
}
func (m *MessageMediaPhoto ) Encode (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't encode messageMediaPhoto#695150d7 as nil" )
}
b .PutID (MessageMediaPhotoTypeID )
return m .EncodeBare (b )
}
func (m *MessageMediaPhoto ) EncodeBare (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't encode messageMediaPhoto#695150d7 as nil" )
}
m .SetFlags ()
if err := m .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messageMediaPhoto#695150d7: field flags: %w" , err )
}
if m .Flags .Has (0 ) {
if m .Photo == nil {
return fmt .Errorf ("unable to encode messageMediaPhoto#695150d7: field photo is nil" )
}
if err := m .Photo .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messageMediaPhoto#695150d7: field photo: %w" , err )
}
}
if m .Flags .Has (2 ) {
b .PutInt (m .TTLSeconds )
}
return nil
}
func (m *MessageMediaPhoto ) Decode (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't decode messageMediaPhoto#695150d7 to nil" )
}
if err := b .ConsumeID (MessageMediaPhotoTypeID ); err != nil {
return fmt .Errorf ("unable to decode messageMediaPhoto#695150d7: %w" , err )
}
return m .DecodeBare (b )
}
func (m *MessageMediaPhoto ) DecodeBare (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't decode messageMediaPhoto#695150d7 to nil" )
}
{
if err := m .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode messageMediaPhoto#695150d7: field flags: %w" , err )
}
}
m .Spoiler = m .Flags .Has (3 )
if m .Flags .Has (0 ) {
value , err := DecodePhoto (b )
if err != nil {
return fmt .Errorf ("unable to decode messageMediaPhoto#695150d7: field photo: %w" , err )
}
m .Photo = value
}
if m .Flags .Has (2 ) {
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode messageMediaPhoto#695150d7: field ttl_seconds: %w" , err )
}
m .TTLSeconds = value
}
return nil
}
func (m *MessageMediaPhoto ) SetSpoiler (value bool ) {
if value {
m .Flags .Set (3 )
m .Spoiler = true
} else {
m .Flags .Unset (3 )
m .Spoiler = false
}
}
func (m *MessageMediaPhoto ) GetSpoiler () (value bool ) {
if m == nil {
return
}
return m .Flags .Has (3 )
}
func (m *MessageMediaPhoto ) SetPhoto (value PhotoClass ) {
m .Flags .Set (0 )
m .Photo = value
}
func (m *MessageMediaPhoto ) GetPhoto () (value PhotoClass , ok bool ) {
if m == nil {
return
}
if !m .Flags .Has (0 ) {
return value , false
}
return m .Photo , true
}
func (m *MessageMediaPhoto ) SetTTLSeconds (value int ) {
m .Flags .Set (2 )
m .TTLSeconds = value
}
func (m *MessageMediaPhoto ) GetTTLSeconds () (value int , ok bool ) {
if m == nil {
return
}
if !m .Flags .Has (2 ) {
return value , false
}
return m .TTLSeconds , true
}
type MessageMediaGeo struct {
Geo GeoPointClass
}
const MessageMediaGeoTypeID = 0x56e0d474
func (m MessageMediaGeo ) construct () MessageMediaClass { return &m }
var (
_ bin .Encoder = &MessageMediaGeo {}
_ bin .Decoder = &MessageMediaGeo {}
_ bin .BareEncoder = &MessageMediaGeo {}
_ bin .BareDecoder = &MessageMediaGeo {}
_ MessageMediaClass = &MessageMediaGeo {}
)
func (m *MessageMediaGeo ) Zero () bool {
if m == nil {
return true
}
if !(m .Geo == nil ) {
return false
}
return true
}
func (m *MessageMediaGeo ) String () string {
if m == nil {
return "MessageMediaGeo(nil)"
}
type Alias MessageMediaGeo
return fmt .Sprintf ("MessageMediaGeo%+v" , Alias (*m ))
}
func (m *MessageMediaGeo ) FillFrom (from interface {
GetGeo () (value GeoPointClass )
}) {
m .Geo = from .GetGeo ()
}
func (*MessageMediaGeo ) TypeID () uint32 {
return MessageMediaGeoTypeID
}
func (*MessageMediaGeo ) TypeName () string {
return "messageMediaGeo"
}
func (m *MessageMediaGeo ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messageMediaGeo" ,
ID : MessageMediaGeoTypeID ,
}
if m == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Geo" ,
SchemaName : "geo" ,
},
}
return typ
}
func (m *MessageMediaGeo ) Encode (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't encode messageMediaGeo#56e0d474 as nil" )
}
b .PutID (MessageMediaGeoTypeID )
return m .EncodeBare (b )
}
func (m *MessageMediaGeo ) EncodeBare (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't encode messageMediaGeo#56e0d474 as nil" )
}
if m .Geo == nil {
return fmt .Errorf ("unable to encode messageMediaGeo#56e0d474: field geo is nil" )
}
if err := m .Geo .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messageMediaGeo#56e0d474: field geo: %w" , err )
}
return nil
}
func (m *MessageMediaGeo ) Decode (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't decode messageMediaGeo#56e0d474 to nil" )
}
if err := b .ConsumeID (MessageMediaGeoTypeID ); err != nil {
return fmt .Errorf ("unable to decode messageMediaGeo#56e0d474: %w" , err )
}
return m .DecodeBare (b )
}
func (m *MessageMediaGeo ) DecodeBare (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't decode messageMediaGeo#56e0d474 to nil" )
}
{
value , err := DecodeGeoPoint (b )
if err != nil {
return fmt .Errorf ("unable to decode messageMediaGeo#56e0d474: field geo: %w" , err )
}
m .Geo = value
}
return nil
}
func (m *MessageMediaGeo ) GetGeo () (value GeoPointClass ) {
if m == nil {
return
}
return m .Geo
}
type MessageMediaContact struct {
PhoneNumber string
FirstName string
LastName string
Vcard string
UserID int64
}
const MessageMediaContactTypeID = 0x70322949
func (m MessageMediaContact ) construct () MessageMediaClass { return &m }
var (
_ bin .Encoder = &MessageMediaContact {}
_ bin .Decoder = &MessageMediaContact {}
_ bin .BareEncoder = &MessageMediaContact {}
_ bin .BareDecoder = &MessageMediaContact {}
_ MessageMediaClass = &MessageMediaContact {}
)
func (m *MessageMediaContact ) Zero () bool {
if m == nil {
return true
}
if !(m .PhoneNumber == "" ) {
return false
}
if !(m .FirstName == "" ) {
return false
}
if !(m .LastName == "" ) {
return false
}
if !(m .Vcard == "" ) {
return false
}
if !(m .UserID == 0 ) {
return false
}
return true
}
func (m *MessageMediaContact ) String () string {
if m == nil {
return "MessageMediaContact(nil)"
}
type Alias MessageMediaContact
return fmt .Sprintf ("MessageMediaContact%+v" , Alias (*m ))
}
func (m *MessageMediaContact ) FillFrom (from interface {
GetPhoneNumber () (value string )
GetFirstName () (value string )
GetLastName () (value string )
GetVcard () (value string )
GetUserID () (value int64 )
}) {
m .PhoneNumber = from .GetPhoneNumber ()
m .FirstName = from .GetFirstName ()
m .LastName = from .GetLastName ()
m .Vcard = from .GetVcard ()
m .UserID = from .GetUserID ()
}
func (*MessageMediaContact ) TypeID () uint32 {
return MessageMediaContactTypeID
}
func (*MessageMediaContact ) TypeName () string {
return "messageMediaContact"
}
func (m *MessageMediaContact ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messageMediaContact" ,
ID : MessageMediaContactTypeID ,
}
if m == 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 : "UserID" ,
SchemaName : "user_id" ,
},
}
return typ
}
func (m *MessageMediaContact ) Encode (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't encode messageMediaContact#70322949 as nil" )
}
b .PutID (MessageMediaContactTypeID )
return m .EncodeBare (b )
}
func (m *MessageMediaContact ) EncodeBare (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't encode messageMediaContact#70322949 as nil" )
}
b .PutString (m .PhoneNumber )
b .PutString (m .FirstName )
b .PutString (m .LastName )
b .PutString (m .Vcard )
b .PutLong (m .UserID )
return nil
}
func (m *MessageMediaContact ) Decode (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't decode messageMediaContact#70322949 to nil" )
}
if err := b .ConsumeID (MessageMediaContactTypeID ); err != nil {
return fmt .Errorf ("unable to decode messageMediaContact#70322949: %w" , err )
}
return m .DecodeBare (b )
}
func (m *MessageMediaContact ) DecodeBare (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't decode messageMediaContact#70322949 to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode messageMediaContact#70322949: field phone_number: %w" , err )
}
m .PhoneNumber = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode messageMediaContact#70322949: field first_name: %w" , err )
}
m .FirstName = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode messageMediaContact#70322949: field last_name: %w" , err )
}
m .LastName = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode messageMediaContact#70322949: field vcard: %w" , err )
}
m .Vcard = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode messageMediaContact#70322949: field user_id: %w" , err )
}
m .UserID = value
}
return nil
}
func (m *MessageMediaContact ) GetPhoneNumber () (value string ) {
if m == nil {
return
}
return m .PhoneNumber
}
func (m *MessageMediaContact ) GetFirstName () (value string ) {
if m == nil {
return
}
return m .FirstName
}
func (m *MessageMediaContact ) GetLastName () (value string ) {
if m == nil {
return
}
return m .LastName
}
func (m *MessageMediaContact ) GetVcard () (value string ) {
if m == nil {
return
}
return m .Vcard
}
func (m *MessageMediaContact ) GetUserID () (value int64 ) {
if m == nil {
return
}
return m .UserID
}
type MessageMediaUnsupported struct {
}
const MessageMediaUnsupportedTypeID = 0x9f84f49e
func (m MessageMediaUnsupported ) construct () MessageMediaClass { return &m }
var (
_ bin .Encoder = &MessageMediaUnsupported {}
_ bin .Decoder = &MessageMediaUnsupported {}
_ bin .BareEncoder = &MessageMediaUnsupported {}
_ bin .BareDecoder = &MessageMediaUnsupported {}
_ MessageMediaClass = &MessageMediaUnsupported {}
)
func (m *MessageMediaUnsupported ) Zero () bool {
if m == nil {
return true
}
return true
}
func (m *MessageMediaUnsupported ) String () string {
if m == nil {
return "MessageMediaUnsupported(nil)"
}
type Alias MessageMediaUnsupported
return fmt .Sprintf ("MessageMediaUnsupported%+v" , Alias (*m ))
}
func (*MessageMediaUnsupported ) TypeID () uint32 {
return MessageMediaUnsupportedTypeID
}
func (*MessageMediaUnsupported ) TypeName () string {
return "messageMediaUnsupported"
}
func (m *MessageMediaUnsupported ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messageMediaUnsupported" ,
ID : MessageMediaUnsupportedTypeID ,
}
if m == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {}
return typ
}
func (m *MessageMediaUnsupported ) Encode (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't encode messageMediaUnsupported#9f84f49e as nil" )
}
b .PutID (MessageMediaUnsupportedTypeID )
return m .EncodeBare (b )
}
func (m *MessageMediaUnsupported ) EncodeBare (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't encode messageMediaUnsupported#9f84f49e as nil" )
}
return nil
}
func (m *MessageMediaUnsupported ) Decode (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't decode messageMediaUnsupported#9f84f49e to nil" )
}
if err := b .ConsumeID (MessageMediaUnsupportedTypeID ); err != nil {
return fmt .Errorf ("unable to decode messageMediaUnsupported#9f84f49e: %w" , err )
}
return m .DecodeBare (b )
}
func (m *MessageMediaUnsupported ) DecodeBare (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't decode messageMediaUnsupported#9f84f49e to nil" )
}
return nil
}
type MessageMediaDocument struct {
Flags bin .Fields
Nopremium bool
Spoiler bool
Document DocumentClass
AltDocument DocumentClass
TTLSeconds int
}
const MessageMediaDocumentTypeID = 0x4cf4d72d
func (m MessageMediaDocument ) construct () MessageMediaClass { return &m }
var (
_ bin .Encoder = &MessageMediaDocument {}
_ bin .Decoder = &MessageMediaDocument {}
_ bin .BareEncoder = &MessageMediaDocument {}
_ bin .BareDecoder = &MessageMediaDocument {}
_ MessageMediaClass = &MessageMediaDocument {}
)
func (m *MessageMediaDocument ) Zero () bool {
if m == nil {
return true
}
if !(m .Flags .Zero ()) {
return false
}
if !(m .Nopremium == false ) {
return false
}
if !(m .Spoiler == false ) {
return false
}
if !(m .Document == nil ) {
return false
}
if !(m .AltDocument == nil ) {
return false
}
if !(m .TTLSeconds == 0 ) {
return false
}
return true
}
func (m *MessageMediaDocument ) String () string {
if m == nil {
return "MessageMediaDocument(nil)"
}
type Alias MessageMediaDocument
return fmt .Sprintf ("MessageMediaDocument%+v" , Alias (*m ))
}
func (m *MessageMediaDocument ) FillFrom (from interface {
GetNopremium () (value bool )
GetSpoiler () (value bool )
GetDocument () (value DocumentClass , ok bool )
GetAltDocument () (value DocumentClass , ok bool )
GetTTLSeconds () (value int , ok bool )
}) {
m .Nopremium = from .GetNopremium ()
m .Spoiler = from .GetSpoiler ()
if val , ok := from .GetDocument (); ok {
m .Document = val
}
if val , ok := from .GetAltDocument (); ok {
m .AltDocument = val
}
if val , ok := from .GetTTLSeconds (); ok {
m .TTLSeconds = val
}
}
func (*MessageMediaDocument ) TypeID () uint32 {
return MessageMediaDocumentTypeID
}
func (*MessageMediaDocument ) TypeName () string {
return "messageMediaDocument"
}
func (m *MessageMediaDocument ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messageMediaDocument" ,
ID : MessageMediaDocumentTypeID ,
}
if m == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Nopremium" ,
SchemaName : "nopremium" ,
Null : !m .Flags .Has (3 ),
},
{
Name : "Spoiler" ,
SchemaName : "spoiler" ,
Null : !m .Flags .Has (4 ),
},
{
Name : "Document" ,
SchemaName : "document" ,
Null : !m .Flags .Has (0 ),
},
{
Name : "AltDocument" ,
SchemaName : "alt_document" ,
Null : !m .Flags .Has (5 ),
},
{
Name : "TTLSeconds" ,
SchemaName : "ttl_seconds" ,
Null : !m .Flags .Has (2 ),
},
}
return typ
}
func (m *MessageMediaDocument ) SetFlags () {
if !(m .Nopremium == false ) {
m .Flags .Set (3 )
}
if !(m .Spoiler == false ) {
m .Flags .Set (4 )
}
if !(m .Document == nil ) {
m .Flags .Set (0 )
}
if !(m .AltDocument == nil ) {
m .Flags .Set (5 )
}
if !(m .TTLSeconds == 0 ) {
m .Flags .Set (2 )
}
}
func (m *MessageMediaDocument ) Encode (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't encode messageMediaDocument#4cf4d72d as nil" )
}
b .PutID (MessageMediaDocumentTypeID )
return m .EncodeBare (b )
}
func (m *MessageMediaDocument ) EncodeBare (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't encode messageMediaDocument#4cf4d72d as nil" )
}
m .SetFlags ()
if err := m .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messageMediaDocument#4cf4d72d: field flags: %w" , err )
}
if m .Flags .Has (0 ) {
if m .Document == nil {
return fmt .Errorf ("unable to encode messageMediaDocument#4cf4d72d: field document is nil" )
}
if err := m .Document .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messageMediaDocument#4cf4d72d: field document: %w" , err )
}
}
if m .Flags .Has (5 ) {
if m .AltDocument == nil {
return fmt .Errorf ("unable to encode messageMediaDocument#4cf4d72d: field alt_document is nil" )
}
if err := m .AltDocument .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messageMediaDocument#4cf4d72d: field alt_document: %w" , err )
}
}
if m .Flags .Has (2 ) {
b .PutInt (m .TTLSeconds )
}
return nil
}
func (m *MessageMediaDocument ) Decode (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't decode messageMediaDocument#4cf4d72d to nil" )
}
if err := b .ConsumeID (MessageMediaDocumentTypeID ); err != nil {
return fmt .Errorf ("unable to decode messageMediaDocument#4cf4d72d: %w" , err )
}
return m .DecodeBare (b )
}
func (m *MessageMediaDocument ) DecodeBare (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't decode messageMediaDocument#4cf4d72d to nil" )
}
{
if err := m .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode messageMediaDocument#4cf4d72d: field flags: %w" , err )
}
}
m .Nopremium = m .Flags .Has (3 )
m .Spoiler = m .Flags .Has (4 )
if m .Flags .Has (0 ) {
value , err := DecodeDocument (b )
if err != nil {
return fmt .Errorf ("unable to decode messageMediaDocument#4cf4d72d: field document: %w" , err )
}
m .Document = value
}
if m .Flags .Has (5 ) {
value , err := DecodeDocument (b )
if err != nil {
return fmt .Errorf ("unable to decode messageMediaDocument#4cf4d72d: field alt_document: %w" , err )
}
m .AltDocument = value
}
if m .Flags .Has (2 ) {
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode messageMediaDocument#4cf4d72d: field ttl_seconds: %w" , err )
}
m .TTLSeconds = value
}
return nil
}
func (m *MessageMediaDocument ) SetNopremium (value bool ) {
if value {
m .Flags .Set (3 )
m .Nopremium = true
} else {
m .Flags .Unset (3 )
m .Nopremium = false
}
}
func (m *MessageMediaDocument ) GetNopremium () (value bool ) {
if m == nil {
return
}
return m .Flags .Has (3 )
}
func (m *MessageMediaDocument ) SetSpoiler (value bool ) {
if value {
m .Flags .Set (4 )
m .Spoiler = true
} else {
m .Flags .Unset (4 )
m .Spoiler = false
}
}
func (m *MessageMediaDocument ) GetSpoiler () (value bool ) {
if m == nil {
return
}
return m .Flags .Has (4 )
}
func (m *MessageMediaDocument ) SetDocument (value DocumentClass ) {
m .Flags .Set (0 )
m .Document = value
}
func (m *MessageMediaDocument ) GetDocument () (value DocumentClass , ok bool ) {
if m == nil {
return
}
if !m .Flags .Has (0 ) {
return value , false
}
return m .Document , true
}
func (m *MessageMediaDocument ) SetAltDocument (value DocumentClass ) {
m .Flags .Set (5 )
m .AltDocument = value
}
func (m *MessageMediaDocument ) GetAltDocument () (value DocumentClass , ok bool ) {
if m == nil {
return
}
if !m .Flags .Has (5 ) {
return value , false
}
return m .AltDocument , true
}
func (m *MessageMediaDocument ) SetTTLSeconds (value int ) {
m .Flags .Set (2 )
m .TTLSeconds = value
}
func (m *MessageMediaDocument ) GetTTLSeconds () (value int , ok bool ) {
if m == nil {
return
}
if !m .Flags .Has (2 ) {
return value , false
}
return m .TTLSeconds , true
}
type MessageMediaWebPage struct {
Flags bin .Fields
ForceLargeMedia bool
ForceSmallMedia bool
Manual bool
Safe bool
Webpage WebPageClass
}
const MessageMediaWebPageTypeID = 0xddf10c3b
func (m MessageMediaWebPage ) construct () MessageMediaClass { return &m }
var (
_ bin .Encoder = &MessageMediaWebPage {}
_ bin .Decoder = &MessageMediaWebPage {}
_ bin .BareEncoder = &MessageMediaWebPage {}
_ bin .BareDecoder = &MessageMediaWebPage {}
_ MessageMediaClass = &MessageMediaWebPage {}
)
func (m *MessageMediaWebPage ) Zero () bool {
if m == nil {
return true
}
if !(m .Flags .Zero ()) {
return false
}
if !(m .ForceLargeMedia == false ) {
return false
}
if !(m .ForceSmallMedia == false ) {
return false
}
if !(m .Manual == false ) {
return false
}
if !(m .Safe == false ) {
return false
}
if !(m .Webpage == nil ) {
return false
}
return true
}
func (m *MessageMediaWebPage ) String () string {
if m == nil {
return "MessageMediaWebPage(nil)"
}
type Alias MessageMediaWebPage
return fmt .Sprintf ("MessageMediaWebPage%+v" , Alias (*m ))
}
func (m *MessageMediaWebPage ) FillFrom (from interface {
GetForceLargeMedia () (value bool )
GetForceSmallMedia () (value bool )
GetManual () (value bool )
GetSafe () (value bool )
GetWebpage () (value WebPageClass )
}) {
m .ForceLargeMedia = from .GetForceLargeMedia ()
m .ForceSmallMedia = from .GetForceSmallMedia ()
m .Manual = from .GetManual ()
m .Safe = from .GetSafe ()
m .Webpage = from .GetWebpage ()
}
func (*MessageMediaWebPage ) TypeID () uint32 {
return MessageMediaWebPageTypeID
}
func (*MessageMediaWebPage ) TypeName () string {
return "messageMediaWebPage"
}
func (m *MessageMediaWebPage ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messageMediaWebPage" ,
ID : MessageMediaWebPageTypeID ,
}
if m == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "ForceLargeMedia" ,
SchemaName : "force_large_media" ,
Null : !m .Flags .Has (0 ),
},
{
Name : "ForceSmallMedia" ,
SchemaName : "force_small_media" ,
Null : !m .Flags .Has (1 ),
},
{
Name : "Manual" ,
SchemaName : "manual" ,
Null : !m .Flags .Has (3 ),
},
{
Name : "Safe" ,
SchemaName : "safe" ,
Null : !m .Flags .Has (4 ),
},
{
Name : "Webpage" ,
SchemaName : "webpage" ,
},
}
return typ
}
func (m *MessageMediaWebPage ) SetFlags () {
if !(m .ForceLargeMedia == false ) {
m .Flags .Set (0 )
}
if !(m .ForceSmallMedia == false ) {
m .Flags .Set (1 )
}
if !(m .Manual == false ) {
m .Flags .Set (3 )
}
if !(m .Safe == false ) {
m .Flags .Set (4 )
}
}
func (m *MessageMediaWebPage ) Encode (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't encode messageMediaWebPage#ddf10c3b as nil" )
}
b .PutID (MessageMediaWebPageTypeID )
return m .EncodeBare (b )
}
func (m *MessageMediaWebPage ) EncodeBare (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't encode messageMediaWebPage#ddf10c3b as nil" )
}
m .SetFlags ()
if err := m .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messageMediaWebPage#ddf10c3b: field flags: %w" , err )
}
if m .Webpage == nil {
return fmt .Errorf ("unable to encode messageMediaWebPage#ddf10c3b: field webpage is nil" )
}
if err := m .Webpage .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messageMediaWebPage#ddf10c3b: field webpage: %w" , err )
}
return nil
}
func (m *MessageMediaWebPage ) Decode (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't decode messageMediaWebPage#ddf10c3b to nil" )
}
if err := b .ConsumeID (MessageMediaWebPageTypeID ); err != nil {
return fmt .Errorf ("unable to decode messageMediaWebPage#ddf10c3b: %w" , err )
}
return m .DecodeBare (b )
}
func (m *MessageMediaWebPage ) DecodeBare (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't decode messageMediaWebPage#ddf10c3b to nil" )
}
{
if err := m .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode messageMediaWebPage#ddf10c3b: field flags: %w" , err )
}
}
m .ForceLargeMedia = m .Flags .Has (0 )
m .ForceSmallMedia = m .Flags .Has (1 )
m .Manual = m .Flags .Has (3 )
m .Safe = m .Flags .Has (4 )
{
value , err := DecodeWebPage (b )
if err != nil {
return fmt .Errorf ("unable to decode messageMediaWebPage#ddf10c3b: field webpage: %w" , err )
}
m .Webpage = value
}
return nil
}
func (m *MessageMediaWebPage ) SetForceLargeMedia (value bool ) {
if value {
m .Flags .Set (0 )
m .ForceLargeMedia = true
} else {
m .Flags .Unset (0 )
m .ForceLargeMedia = false
}
}
func (m *MessageMediaWebPage ) GetForceLargeMedia () (value bool ) {
if m == nil {
return
}
return m .Flags .Has (0 )
}
func (m *MessageMediaWebPage ) SetForceSmallMedia (value bool ) {
if value {
m .Flags .Set (1 )
m .ForceSmallMedia = true
} else {
m .Flags .Unset (1 )
m .ForceSmallMedia = false
}
}
func (m *MessageMediaWebPage ) GetForceSmallMedia () (value bool ) {
if m == nil {
return
}
return m .Flags .Has (1 )
}
func (m *MessageMediaWebPage ) SetManual (value bool ) {
if value {
m .Flags .Set (3 )
m .Manual = true
} else {
m .Flags .Unset (3 )
m .Manual = false
}
}
func (m *MessageMediaWebPage ) GetManual () (value bool ) {
if m == nil {
return
}
return m .Flags .Has (3 )
}
func (m *MessageMediaWebPage ) SetSafe (value bool ) {
if value {
m .Flags .Set (4 )
m .Safe = true
} else {
m .Flags .Unset (4 )
m .Safe = false
}
}
func (m *MessageMediaWebPage ) GetSafe () (value bool ) {
if m == nil {
return
}
return m .Flags .Has (4 )
}
func (m *MessageMediaWebPage ) GetWebpage () (value WebPageClass ) {
if m == nil {
return
}
return m .Webpage
}
type MessageMediaVenue struct {
Geo GeoPointClass
Title string
Address string
Provider string
VenueID string
VenueType string
}
const MessageMediaVenueTypeID = 0x2ec0533f
func (m MessageMediaVenue ) construct () MessageMediaClass { return &m }
var (
_ bin .Encoder = &MessageMediaVenue {}
_ bin .Decoder = &MessageMediaVenue {}
_ bin .BareEncoder = &MessageMediaVenue {}
_ bin .BareDecoder = &MessageMediaVenue {}
_ MessageMediaClass = &MessageMediaVenue {}
)
func (m *MessageMediaVenue ) Zero () bool {
if m == nil {
return true
}
if !(m .Geo == nil ) {
return false
}
if !(m .Title == "" ) {
return false
}
if !(m .Address == "" ) {
return false
}
if !(m .Provider == "" ) {
return false
}
if !(m .VenueID == "" ) {
return false
}
if !(m .VenueType == "" ) {
return false
}
return true
}
func (m *MessageMediaVenue ) String () string {
if m == nil {
return "MessageMediaVenue(nil)"
}
type Alias MessageMediaVenue
return fmt .Sprintf ("MessageMediaVenue%+v" , Alias (*m ))
}
func (m *MessageMediaVenue ) FillFrom (from interface {
GetGeo () (value GeoPointClass )
GetTitle () (value string )
GetAddress () (value string )
GetProvider () (value string )
GetVenueID () (value string )
GetVenueType () (value string )
}) {
m .Geo = from .GetGeo ()
m .Title = from .GetTitle ()
m .Address = from .GetAddress ()
m .Provider = from .GetProvider ()
m .VenueID = from .GetVenueID ()
m .VenueType = from .GetVenueType ()
}
func (*MessageMediaVenue ) TypeID () uint32 {
return MessageMediaVenueTypeID
}
func (*MessageMediaVenue ) TypeName () string {
return "messageMediaVenue"
}
func (m *MessageMediaVenue ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messageMediaVenue" ,
ID : MessageMediaVenueTypeID ,
}
if m == 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" ,
},
}
return typ
}
func (m *MessageMediaVenue ) Encode (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't encode messageMediaVenue#2ec0533f as nil" )
}
b .PutID (MessageMediaVenueTypeID )
return m .EncodeBare (b )
}
func (m *MessageMediaVenue ) EncodeBare (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't encode messageMediaVenue#2ec0533f as nil" )
}
if m .Geo == nil {
return fmt .Errorf ("unable to encode messageMediaVenue#2ec0533f: field geo is nil" )
}
if err := m .Geo .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messageMediaVenue#2ec0533f: field geo: %w" , err )
}
b .PutString (m .Title )
b .PutString (m .Address )
b .PutString (m .Provider )
b .PutString (m .VenueID )
b .PutString (m .VenueType )
return nil
}
func (m *MessageMediaVenue ) Decode (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't decode messageMediaVenue#2ec0533f to nil" )
}
if err := b .ConsumeID (MessageMediaVenueTypeID ); err != nil {
return fmt .Errorf ("unable to decode messageMediaVenue#2ec0533f: %w" , err )
}
return m .DecodeBare (b )
}
func (m *MessageMediaVenue ) DecodeBare (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't decode messageMediaVenue#2ec0533f to nil" )
}
{
value , err := DecodeGeoPoint (b )
if err != nil {
return fmt .Errorf ("unable to decode messageMediaVenue#2ec0533f: field geo: %w" , err )
}
m .Geo = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode messageMediaVenue#2ec0533f: field title: %w" , err )
}
m .Title = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode messageMediaVenue#2ec0533f: field address: %w" , err )
}
m .Address = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode messageMediaVenue#2ec0533f: field provider: %w" , err )
}
m .Provider = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode messageMediaVenue#2ec0533f: field venue_id: %w" , err )
}
m .VenueID = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode messageMediaVenue#2ec0533f: field venue_type: %w" , err )
}
m .VenueType = value
}
return nil
}
func (m *MessageMediaVenue ) GetGeo () (value GeoPointClass ) {
if m == nil {
return
}
return m .Geo
}
func (m *MessageMediaVenue ) GetTitle () (value string ) {
if m == nil {
return
}
return m .Title
}
func (m *MessageMediaVenue ) GetAddress () (value string ) {
if m == nil {
return
}
return m .Address
}
func (m *MessageMediaVenue ) GetProvider () (value string ) {
if m == nil {
return
}
return m .Provider
}
func (m *MessageMediaVenue ) GetVenueID () (value string ) {
if m == nil {
return
}
return m .VenueID
}
func (m *MessageMediaVenue ) GetVenueType () (value string ) {
if m == nil {
return
}
return m .VenueType
}
type MessageMediaGame struct {
Game Game
}
const MessageMediaGameTypeID = 0xfdb19008
func (m MessageMediaGame ) construct () MessageMediaClass { return &m }
var (
_ bin .Encoder = &MessageMediaGame {}
_ bin .Decoder = &MessageMediaGame {}
_ bin .BareEncoder = &MessageMediaGame {}
_ bin .BareDecoder = &MessageMediaGame {}
_ MessageMediaClass = &MessageMediaGame {}
)
func (m *MessageMediaGame ) Zero () bool {
if m == nil {
return true
}
if !(m .Game .Zero ()) {
return false
}
return true
}
func (m *MessageMediaGame ) String () string {
if m == nil {
return "MessageMediaGame(nil)"
}
type Alias MessageMediaGame
return fmt .Sprintf ("MessageMediaGame%+v" , Alias (*m ))
}
func (m *MessageMediaGame ) FillFrom (from interface {
GetGame () (value Game )
}) {
m .Game = from .GetGame ()
}
func (*MessageMediaGame ) TypeID () uint32 {
return MessageMediaGameTypeID
}
func (*MessageMediaGame ) TypeName () string {
return "messageMediaGame"
}
func (m *MessageMediaGame ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messageMediaGame" ,
ID : MessageMediaGameTypeID ,
}
if m == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Game" ,
SchemaName : "game" ,
},
}
return typ
}
func (m *MessageMediaGame ) Encode (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't encode messageMediaGame#fdb19008 as nil" )
}
b .PutID (MessageMediaGameTypeID )
return m .EncodeBare (b )
}
func (m *MessageMediaGame ) EncodeBare (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't encode messageMediaGame#fdb19008 as nil" )
}
if err := m .Game .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messageMediaGame#fdb19008: field game: %w" , err )
}
return nil
}
func (m *MessageMediaGame ) Decode (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't decode messageMediaGame#fdb19008 to nil" )
}
if err := b .ConsumeID (MessageMediaGameTypeID ); err != nil {
return fmt .Errorf ("unable to decode messageMediaGame#fdb19008: %w" , err )
}
return m .DecodeBare (b )
}
func (m *MessageMediaGame ) DecodeBare (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't decode messageMediaGame#fdb19008 to nil" )
}
{
if err := m .Game .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode messageMediaGame#fdb19008: field game: %w" , err )
}
}
return nil
}
func (m *MessageMediaGame ) GetGame () (value Game ) {
if m == nil {
return
}
return m .Game
}
type MessageMediaInvoice struct {
Flags bin .Fields
ShippingAddressRequested bool
Test bool
Title string
Description string
Photo WebDocumentClass
ReceiptMsgID int
Currency string
TotalAmount int64
StartParam string
ExtendedMedia MessageExtendedMediaClass
}
const MessageMediaInvoiceTypeID = 0xf6a548d3
func (m MessageMediaInvoice ) construct () MessageMediaClass { return &m }
var (
_ bin .Encoder = &MessageMediaInvoice {}
_ bin .Decoder = &MessageMediaInvoice {}
_ bin .BareEncoder = &MessageMediaInvoice {}
_ bin .BareDecoder = &MessageMediaInvoice {}
_ MessageMediaClass = &MessageMediaInvoice {}
)
func (m *MessageMediaInvoice ) Zero () bool {
if m == nil {
return true
}
if !(m .Flags .Zero ()) {
return false
}
if !(m .ShippingAddressRequested == false ) {
return false
}
if !(m .Test == false ) {
return false
}
if !(m .Title == "" ) {
return false
}
if !(m .Description == "" ) {
return false
}
if !(m .Photo == nil ) {
return false
}
if !(m .ReceiptMsgID == 0 ) {
return false
}
if !(m .Currency == "" ) {
return false
}
if !(m .TotalAmount == 0 ) {
return false
}
if !(m .StartParam == "" ) {
return false
}
if !(m .ExtendedMedia == nil ) {
return false
}
return true
}
func (m *MessageMediaInvoice ) String () string {
if m == nil {
return "MessageMediaInvoice(nil)"
}
type Alias MessageMediaInvoice
return fmt .Sprintf ("MessageMediaInvoice%+v" , Alias (*m ))
}
func (m *MessageMediaInvoice ) FillFrom (from interface {
GetShippingAddressRequested () (value bool )
GetTest () (value bool )
GetTitle () (value string )
GetDescription () (value string )
GetPhoto () (value WebDocumentClass , ok bool )
GetReceiptMsgID () (value int , ok bool )
GetCurrency () (value string )
GetTotalAmount () (value int64 )
GetStartParam () (value string )
GetExtendedMedia () (value MessageExtendedMediaClass , ok bool )
}) {
m .ShippingAddressRequested = from .GetShippingAddressRequested ()
m .Test = from .GetTest ()
m .Title = from .GetTitle ()
m .Description = from .GetDescription ()
if val , ok := from .GetPhoto (); ok {
m .Photo = val
}
if val , ok := from .GetReceiptMsgID (); ok {
m .ReceiptMsgID = val
}
m .Currency = from .GetCurrency ()
m .TotalAmount = from .GetTotalAmount ()
m .StartParam = from .GetStartParam ()
if val , ok := from .GetExtendedMedia (); ok {
m .ExtendedMedia = val
}
}
func (*MessageMediaInvoice ) TypeID () uint32 {
return MessageMediaInvoiceTypeID
}
func (*MessageMediaInvoice ) TypeName () string {
return "messageMediaInvoice"
}
func (m *MessageMediaInvoice ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messageMediaInvoice" ,
ID : MessageMediaInvoiceTypeID ,
}
if m == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "ShippingAddressRequested" ,
SchemaName : "shipping_address_requested" ,
Null : !m .Flags .Has (1 ),
},
{
Name : "Test" ,
SchemaName : "test" ,
Null : !m .Flags .Has (3 ),
},
{
Name : "Title" ,
SchemaName : "title" ,
},
{
Name : "Description" ,
SchemaName : "description" ,
},
{
Name : "Photo" ,
SchemaName : "photo" ,
Null : !m .Flags .Has (0 ),
},
{
Name : "ReceiptMsgID" ,
SchemaName : "receipt_msg_id" ,
Null : !m .Flags .Has (2 ),
},
{
Name : "Currency" ,
SchemaName : "currency" ,
},
{
Name : "TotalAmount" ,
SchemaName : "total_amount" ,
},
{
Name : "StartParam" ,
SchemaName : "start_param" ,
},
{
Name : "ExtendedMedia" ,
SchemaName : "extended_media" ,
Null : !m .Flags .Has (4 ),
},
}
return typ
}
func (m *MessageMediaInvoice ) SetFlags () {
if !(m .ShippingAddressRequested == false ) {
m .Flags .Set (1 )
}
if !(m .Test == false ) {
m .Flags .Set (3 )
}
if !(m .Photo == nil ) {
m .Flags .Set (0 )
}
if !(m .ReceiptMsgID == 0 ) {
m .Flags .Set (2 )
}
if !(m .ExtendedMedia == nil ) {
m .Flags .Set (4 )
}
}
func (m *MessageMediaInvoice ) Encode (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't encode messageMediaInvoice#f6a548d3 as nil" )
}
b .PutID (MessageMediaInvoiceTypeID )
return m .EncodeBare (b )
}
func (m *MessageMediaInvoice ) EncodeBare (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't encode messageMediaInvoice#f6a548d3 as nil" )
}
m .SetFlags ()
if err := m .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messageMediaInvoice#f6a548d3: field flags: %w" , err )
}
b .PutString (m .Title )
b .PutString (m .Description )
if m .Flags .Has (0 ) {
if m .Photo == nil {
return fmt .Errorf ("unable to encode messageMediaInvoice#f6a548d3: field photo is nil" )
}
if err := m .Photo .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messageMediaInvoice#f6a548d3: field photo: %w" , err )
}
}
if m .Flags .Has (2 ) {
b .PutInt (m .ReceiptMsgID )
}
b .PutString (m .Currency )
b .PutLong (m .TotalAmount )
b .PutString (m .StartParam )
if m .Flags .Has (4 ) {
if m .ExtendedMedia == nil {
return fmt .Errorf ("unable to encode messageMediaInvoice#f6a548d3: field extended_media is nil" )
}
if err := m .ExtendedMedia .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messageMediaInvoice#f6a548d3: field extended_media: %w" , err )
}
}
return nil
}
func (m *MessageMediaInvoice ) Decode (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't decode messageMediaInvoice#f6a548d3 to nil" )
}
if err := b .ConsumeID (MessageMediaInvoiceTypeID ); err != nil {
return fmt .Errorf ("unable to decode messageMediaInvoice#f6a548d3: %w" , err )
}
return m .DecodeBare (b )
}
func (m *MessageMediaInvoice ) DecodeBare (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't decode messageMediaInvoice#f6a548d3 to nil" )
}
{
if err := m .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode messageMediaInvoice#f6a548d3: field flags: %w" , err )
}
}
m .ShippingAddressRequested = m .Flags .Has (1 )
m .Test = m .Flags .Has (3 )
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode messageMediaInvoice#f6a548d3: field title: %w" , err )
}
m .Title = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode messageMediaInvoice#f6a548d3: field description: %w" , err )
}
m .Description = value
}
if m .Flags .Has (0 ) {
value , err := DecodeWebDocument (b )
if err != nil {
return fmt .Errorf ("unable to decode messageMediaInvoice#f6a548d3: field photo: %w" , err )
}
m .Photo = value
}
if m .Flags .Has (2 ) {
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode messageMediaInvoice#f6a548d3: field receipt_msg_id: %w" , err )
}
m .ReceiptMsgID = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode messageMediaInvoice#f6a548d3: field currency: %w" , err )
}
m .Currency = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode messageMediaInvoice#f6a548d3: field total_amount: %w" , err )
}
m .TotalAmount = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode messageMediaInvoice#f6a548d3: field start_param: %w" , err )
}
m .StartParam = value
}
if m .Flags .Has (4 ) {
value , err := DecodeMessageExtendedMedia (b )
if err != nil {
return fmt .Errorf ("unable to decode messageMediaInvoice#f6a548d3: field extended_media: %w" , err )
}
m .ExtendedMedia = value
}
return nil
}
func (m *MessageMediaInvoice ) SetShippingAddressRequested (value bool ) {
if value {
m .Flags .Set (1 )
m .ShippingAddressRequested = true
} else {
m .Flags .Unset (1 )
m .ShippingAddressRequested = false
}
}
func (m *MessageMediaInvoice ) GetShippingAddressRequested () (value bool ) {
if m == nil {
return
}
return m .Flags .Has (1 )
}
func (m *MessageMediaInvoice ) SetTest (value bool ) {
if value {
m .Flags .Set (3 )
m .Test = true
} else {
m .Flags .Unset (3 )
m .Test = false
}
}
func (m *MessageMediaInvoice ) GetTest () (value bool ) {
if m == nil {
return
}
return m .Flags .Has (3 )
}
func (m *MessageMediaInvoice ) GetTitle () (value string ) {
if m == nil {
return
}
return m .Title
}
func (m *MessageMediaInvoice ) GetDescription () (value string ) {
if m == nil {
return
}
return m .Description
}
func (m *MessageMediaInvoice ) SetPhoto (value WebDocumentClass ) {
m .Flags .Set (0 )
m .Photo = value
}
func (m *MessageMediaInvoice ) GetPhoto () (value WebDocumentClass , ok bool ) {
if m == nil {
return
}
if !m .Flags .Has (0 ) {
return value , false
}
return m .Photo , true
}
func (m *MessageMediaInvoice ) SetReceiptMsgID (value int ) {
m .Flags .Set (2 )
m .ReceiptMsgID = value
}
func (m *MessageMediaInvoice ) GetReceiptMsgID () (value int , ok bool ) {
if m == nil {
return
}
if !m .Flags .Has (2 ) {
return value , false
}
return m .ReceiptMsgID , true
}
func (m *MessageMediaInvoice ) GetCurrency () (value string ) {
if m == nil {
return
}
return m .Currency
}
func (m *MessageMediaInvoice ) GetTotalAmount () (value int64 ) {
if m == nil {
return
}
return m .TotalAmount
}
func (m *MessageMediaInvoice ) GetStartParam () (value string ) {
if m == nil {
return
}
return m .StartParam
}
func (m *MessageMediaInvoice ) SetExtendedMedia (value MessageExtendedMediaClass ) {
m .Flags .Set (4 )
m .ExtendedMedia = value
}
func (m *MessageMediaInvoice ) GetExtendedMedia () (value MessageExtendedMediaClass , ok bool ) {
if m == nil {
return
}
if !m .Flags .Has (4 ) {
return value , false
}
return m .ExtendedMedia , true
}
type MessageMediaGeoLive struct {
Flags bin .Fields
Geo GeoPointClass
Heading int
Period int
ProximityNotificationRadius int
}
const MessageMediaGeoLiveTypeID = 0xb940c666
func (m MessageMediaGeoLive ) construct () MessageMediaClass { return &m }
var (
_ bin .Encoder = &MessageMediaGeoLive {}
_ bin .Decoder = &MessageMediaGeoLive {}
_ bin .BareEncoder = &MessageMediaGeoLive {}
_ bin .BareDecoder = &MessageMediaGeoLive {}
_ MessageMediaClass = &MessageMediaGeoLive {}
)
func (m *MessageMediaGeoLive ) Zero () bool {
if m == nil {
return true
}
if !(m .Flags .Zero ()) {
return false
}
if !(m .Geo == nil ) {
return false
}
if !(m .Heading == 0 ) {
return false
}
if !(m .Period == 0 ) {
return false
}
if !(m .ProximityNotificationRadius == 0 ) {
return false
}
return true
}
func (m *MessageMediaGeoLive ) String () string {
if m == nil {
return "MessageMediaGeoLive(nil)"
}
type Alias MessageMediaGeoLive
return fmt .Sprintf ("MessageMediaGeoLive%+v" , Alias (*m ))
}
func (m *MessageMediaGeoLive ) FillFrom (from interface {
GetGeo () (value GeoPointClass )
GetHeading () (value int , ok bool )
GetPeriod () (value int )
GetProximityNotificationRadius () (value int , ok bool )
}) {
m .Geo = from .GetGeo ()
if val , ok := from .GetHeading (); ok {
m .Heading = val
}
m .Period = from .GetPeriod ()
if val , ok := from .GetProximityNotificationRadius (); ok {
m .ProximityNotificationRadius = val
}
}
func (*MessageMediaGeoLive ) TypeID () uint32 {
return MessageMediaGeoLiveTypeID
}
func (*MessageMediaGeoLive ) TypeName () string {
return "messageMediaGeoLive"
}
func (m *MessageMediaGeoLive ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messageMediaGeoLive" ,
ID : MessageMediaGeoLiveTypeID ,
}
if m == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Geo" ,
SchemaName : "geo" ,
},
{
Name : "Heading" ,
SchemaName : "heading" ,
Null : !m .Flags .Has (0 ),
},
{
Name : "Period" ,
SchemaName : "period" ,
},
{
Name : "ProximityNotificationRadius" ,
SchemaName : "proximity_notification_radius" ,
Null : !m .Flags .Has (1 ),
},
}
return typ
}
func (m *MessageMediaGeoLive ) SetFlags () {
if !(m .Heading == 0 ) {
m .Flags .Set (0 )
}
if !(m .ProximityNotificationRadius == 0 ) {
m .Flags .Set (1 )
}
}
func (m *MessageMediaGeoLive ) Encode (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't encode messageMediaGeoLive#b940c666 as nil" )
}
b .PutID (MessageMediaGeoLiveTypeID )
return m .EncodeBare (b )
}
func (m *MessageMediaGeoLive ) EncodeBare (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't encode messageMediaGeoLive#b940c666 as nil" )
}
m .SetFlags ()
if err := m .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messageMediaGeoLive#b940c666: field flags: %w" , err )
}
if m .Geo == nil {
return fmt .Errorf ("unable to encode messageMediaGeoLive#b940c666: field geo is nil" )
}
if err := m .Geo .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messageMediaGeoLive#b940c666: field geo: %w" , err )
}
if m .Flags .Has (0 ) {
b .PutInt (m .Heading )
}
b .PutInt (m .Period )
if m .Flags .Has (1 ) {
b .PutInt (m .ProximityNotificationRadius )
}
return nil
}
func (m *MessageMediaGeoLive ) Decode (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't decode messageMediaGeoLive#b940c666 to nil" )
}
if err := b .ConsumeID (MessageMediaGeoLiveTypeID ); err != nil {
return fmt .Errorf ("unable to decode messageMediaGeoLive#b940c666: %w" , err )
}
return m .DecodeBare (b )
}
func (m *MessageMediaGeoLive ) DecodeBare (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't decode messageMediaGeoLive#b940c666 to nil" )
}
{
if err := m .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode messageMediaGeoLive#b940c666: field flags: %w" , err )
}
}
{
value , err := DecodeGeoPoint (b )
if err != nil {
return fmt .Errorf ("unable to decode messageMediaGeoLive#b940c666: field geo: %w" , err )
}
m .Geo = value
}
if m .Flags .Has (0 ) {
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode messageMediaGeoLive#b940c666: field heading: %w" , err )
}
m .Heading = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode messageMediaGeoLive#b940c666: field period: %w" , err )
}
m .Period = value
}
if m .Flags .Has (1 ) {
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode messageMediaGeoLive#b940c666: field proximity_notification_radius: %w" , err )
}
m .ProximityNotificationRadius = value
}
return nil
}
func (m *MessageMediaGeoLive ) GetGeo () (value GeoPointClass ) {
if m == nil {
return
}
return m .Geo
}
func (m *MessageMediaGeoLive ) SetHeading (value int ) {
m .Flags .Set (0 )
m .Heading = value
}
func (m *MessageMediaGeoLive ) GetHeading () (value int , ok bool ) {
if m == nil {
return
}
if !m .Flags .Has (0 ) {
return value , false
}
return m .Heading , true
}
func (m *MessageMediaGeoLive ) GetPeriod () (value int ) {
if m == nil {
return
}
return m .Period
}
func (m *MessageMediaGeoLive ) SetProximityNotificationRadius (value int ) {
m .Flags .Set (1 )
m .ProximityNotificationRadius = value
}
func (m *MessageMediaGeoLive ) GetProximityNotificationRadius () (value int , ok bool ) {
if m == nil {
return
}
if !m .Flags .Has (1 ) {
return value , false
}
return m .ProximityNotificationRadius , true
}
type MessageMediaPoll struct {
Poll Poll
Results PollResults
}
const MessageMediaPollTypeID = 0x4bd6e798
func (m MessageMediaPoll ) construct () MessageMediaClass { return &m }
var (
_ bin .Encoder = &MessageMediaPoll {}
_ bin .Decoder = &MessageMediaPoll {}
_ bin .BareEncoder = &MessageMediaPoll {}
_ bin .BareDecoder = &MessageMediaPoll {}
_ MessageMediaClass = &MessageMediaPoll {}
)
func (m *MessageMediaPoll ) Zero () bool {
if m == nil {
return true
}
if !(m .Poll .Zero ()) {
return false
}
if !(m .Results .Zero ()) {
return false
}
return true
}
func (m *MessageMediaPoll ) String () string {
if m == nil {
return "MessageMediaPoll(nil)"
}
type Alias MessageMediaPoll
return fmt .Sprintf ("MessageMediaPoll%+v" , Alias (*m ))
}
func (m *MessageMediaPoll ) FillFrom (from interface {
GetPoll () (value Poll )
GetResults () (value PollResults )
}) {
m .Poll = from .GetPoll ()
m .Results = from .GetResults ()
}
func (*MessageMediaPoll ) TypeID () uint32 {
return MessageMediaPollTypeID
}
func (*MessageMediaPoll ) TypeName () string {
return "messageMediaPoll"
}
func (m *MessageMediaPoll ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messageMediaPoll" ,
ID : MessageMediaPollTypeID ,
}
if m == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Poll" ,
SchemaName : "poll" ,
},
{
Name : "Results" ,
SchemaName : "results" ,
},
}
return typ
}
func (m *MessageMediaPoll ) Encode (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't encode messageMediaPoll#4bd6e798 as nil" )
}
b .PutID (MessageMediaPollTypeID )
return m .EncodeBare (b )
}
func (m *MessageMediaPoll ) EncodeBare (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't encode messageMediaPoll#4bd6e798 as nil" )
}
if err := m .Poll .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messageMediaPoll#4bd6e798: field poll: %w" , err )
}
if err := m .Results .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messageMediaPoll#4bd6e798: field results: %w" , err )
}
return nil
}
func (m *MessageMediaPoll ) Decode (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't decode messageMediaPoll#4bd6e798 to nil" )
}
if err := b .ConsumeID (MessageMediaPollTypeID ); err != nil {
return fmt .Errorf ("unable to decode messageMediaPoll#4bd6e798: %w" , err )
}
return m .DecodeBare (b )
}
func (m *MessageMediaPoll ) DecodeBare (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't decode messageMediaPoll#4bd6e798 to nil" )
}
{
if err := m .Poll .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode messageMediaPoll#4bd6e798: field poll: %w" , err )
}
}
{
if err := m .Results .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode messageMediaPoll#4bd6e798: field results: %w" , err )
}
}
return nil
}
func (m *MessageMediaPoll ) GetPoll () (value Poll ) {
if m == nil {
return
}
return m .Poll
}
func (m *MessageMediaPoll ) GetResults () (value PollResults ) {
if m == nil {
return
}
return m .Results
}
type MessageMediaDice struct {
Value int
Emoticon string
}
const MessageMediaDiceTypeID = 0x3f7ee58b
func (m MessageMediaDice ) construct () MessageMediaClass { return &m }
var (
_ bin .Encoder = &MessageMediaDice {}
_ bin .Decoder = &MessageMediaDice {}
_ bin .BareEncoder = &MessageMediaDice {}
_ bin .BareDecoder = &MessageMediaDice {}
_ MessageMediaClass = &MessageMediaDice {}
)
func (m *MessageMediaDice ) Zero () bool {
if m == nil {
return true
}
if !(m .Value == 0 ) {
return false
}
if !(m .Emoticon == "" ) {
return false
}
return true
}
func (m *MessageMediaDice ) String () string {
if m == nil {
return "MessageMediaDice(nil)"
}
type Alias MessageMediaDice
return fmt .Sprintf ("MessageMediaDice%+v" , Alias (*m ))
}
func (m *MessageMediaDice ) FillFrom (from interface {
GetValue () (value int )
GetEmoticon () (value string )
}) {
m .Value = from .GetValue ()
m .Emoticon = from .GetEmoticon ()
}
func (*MessageMediaDice ) TypeID () uint32 {
return MessageMediaDiceTypeID
}
func (*MessageMediaDice ) TypeName () string {
return "messageMediaDice"
}
func (m *MessageMediaDice ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messageMediaDice" ,
ID : MessageMediaDiceTypeID ,
}
if m == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Value" ,
SchemaName : "value" ,
},
{
Name : "Emoticon" ,
SchemaName : "emoticon" ,
},
}
return typ
}
func (m *MessageMediaDice ) Encode (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't encode messageMediaDice#3f7ee58b as nil" )
}
b .PutID (MessageMediaDiceTypeID )
return m .EncodeBare (b )
}
func (m *MessageMediaDice ) EncodeBare (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't encode messageMediaDice#3f7ee58b as nil" )
}
b .PutInt (m .Value )
b .PutString (m .Emoticon )
return nil
}
func (m *MessageMediaDice ) Decode (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't decode messageMediaDice#3f7ee58b to nil" )
}
if err := b .ConsumeID (MessageMediaDiceTypeID ); err != nil {
return fmt .Errorf ("unable to decode messageMediaDice#3f7ee58b: %w" , err )
}
return m .DecodeBare (b )
}
func (m *MessageMediaDice ) DecodeBare (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't decode messageMediaDice#3f7ee58b to nil" )
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode messageMediaDice#3f7ee58b: field value: %w" , err )
}
m .Value = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode messageMediaDice#3f7ee58b: field emoticon: %w" , err )
}
m .Emoticon = value
}
return nil
}
func (m *MessageMediaDice ) GetValue () (value int ) {
if m == nil {
return
}
return m .Value
}
func (m *MessageMediaDice ) GetEmoticon () (value string ) {
if m == nil {
return
}
return m .Emoticon
}
type MessageMediaStory struct {
Flags bin .Fields
ViaMention bool
Peer PeerClass
ID int
Story StoryItemClass
}
const MessageMediaStoryTypeID = 0x68cb6283
func (m MessageMediaStory ) construct () MessageMediaClass { return &m }
var (
_ bin .Encoder = &MessageMediaStory {}
_ bin .Decoder = &MessageMediaStory {}
_ bin .BareEncoder = &MessageMediaStory {}
_ bin .BareDecoder = &MessageMediaStory {}
_ MessageMediaClass = &MessageMediaStory {}
)
func (m *MessageMediaStory ) Zero () bool {
if m == nil {
return true
}
if !(m .Flags .Zero ()) {
return false
}
if !(m .ViaMention == false ) {
return false
}
if !(m .Peer == nil ) {
return false
}
if !(m .ID == 0 ) {
return false
}
if !(m .Story == nil ) {
return false
}
return true
}
func (m *MessageMediaStory ) String () string {
if m == nil {
return "MessageMediaStory(nil)"
}
type Alias MessageMediaStory
return fmt .Sprintf ("MessageMediaStory%+v" , Alias (*m ))
}
func (m *MessageMediaStory ) FillFrom (from interface {
GetViaMention () (value bool )
GetPeer () (value PeerClass )
GetID () (value int )
GetStory () (value StoryItemClass , ok bool )
}) {
m .ViaMention = from .GetViaMention ()
m .Peer = from .GetPeer ()
m .ID = from .GetID ()
if val , ok := from .GetStory (); ok {
m .Story = val
}
}
func (*MessageMediaStory ) TypeID () uint32 {
return MessageMediaStoryTypeID
}
func (*MessageMediaStory ) TypeName () string {
return "messageMediaStory"
}
func (m *MessageMediaStory ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messageMediaStory" ,
ID : MessageMediaStoryTypeID ,
}
if m == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "ViaMention" ,
SchemaName : "via_mention" ,
Null : !m .Flags .Has (1 ),
},
{
Name : "Peer" ,
SchemaName : "peer" ,
},
{
Name : "ID" ,
SchemaName : "id" ,
},
{
Name : "Story" ,
SchemaName : "story" ,
Null : !m .Flags .Has (0 ),
},
}
return typ
}
func (m *MessageMediaStory ) SetFlags () {
if !(m .ViaMention == false ) {
m .Flags .Set (1 )
}
if !(m .Story == nil ) {
m .Flags .Set (0 )
}
}
func (m *MessageMediaStory ) Encode (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't encode messageMediaStory#68cb6283 as nil" )
}
b .PutID (MessageMediaStoryTypeID )
return m .EncodeBare (b )
}
func (m *MessageMediaStory ) EncodeBare (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't encode messageMediaStory#68cb6283 as nil" )
}
m .SetFlags ()
if err := m .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messageMediaStory#68cb6283: field flags: %w" , err )
}
if m .Peer == nil {
return fmt .Errorf ("unable to encode messageMediaStory#68cb6283: field peer is nil" )
}
if err := m .Peer .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messageMediaStory#68cb6283: field peer: %w" , err )
}
b .PutInt (m .ID )
if m .Flags .Has (0 ) {
if m .Story == nil {
return fmt .Errorf ("unable to encode messageMediaStory#68cb6283: field story is nil" )
}
if err := m .Story .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messageMediaStory#68cb6283: field story: %w" , err )
}
}
return nil
}
func (m *MessageMediaStory ) Decode (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't decode messageMediaStory#68cb6283 to nil" )
}
if err := b .ConsumeID (MessageMediaStoryTypeID ); err != nil {
return fmt .Errorf ("unable to decode messageMediaStory#68cb6283: %w" , err )
}
return m .DecodeBare (b )
}
func (m *MessageMediaStory ) DecodeBare (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't decode messageMediaStory#68cb6283 to nil" )
}
{
if err := m .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode messageMediaStory#68cb6283: field flags: %w" , err )
}
}
m .ViaMention = m .Flags .Has (1 )
{
value , err := DecodePeer (b )
if err != nil {
return fmt .Errorf ("unable to decode messageMediaStory#68cb6283: field peer: %w" , err )
}
m .Peer = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode messageMediaStory#68cb6283: field id: %w" , err )
}
m .ID = value
}
if m .Flags .Has (0 ) {
value , err := DecodeStoryItem (b )
if err != nil {
return fmt .Errorf ("unable to decode messageMediaStory#68cb6283: field story: %w" , err )
}
m .Story = value
}
return nil
}
func (m *MessageMediaStory ) SetViaMention (value bool ) {
if value {
m .Flags .Set (1 )
m .ViaMention = true
} else {
m .Flags .Unset (1 )
m .ViaMention = false
}
}
func (m *MessageMediaStory ) GetViaMention () (value bool ) {
if m == nil {
return
}
return m .Flags .Has (1 )
}
func (m *MessageMediaStory ) GetPeer () (value PeerClass ) {
if m == nil {
return
}
return m .Peer
}
func (m *MessageMediaStory ) GetID () (value int ) {
if m == nil {
return
}
return m .ID
}
func (m *MessageMediaStory ) SetStory (value StoryItemClass ) {
m .Flags .Set (0 )
m .Story = value
}
func (m *MessageMediaStory ) GetStory () (value StoryItemClass , ok bool ) {
if m == nil {
return
}
if !m .Flags .Has (0 ) {
return value , false
}
return m .Story , true
}
type MessageMediaGiveaway struct {
Flags bin .Fields
OnlyNewSubscribers bool
WinnersAreVisible bool
Channels []int64
CountriesISO2 []string
PrizeDescription string
Quantity int
Months int
UntilDate int
}
const MessageMediaGiveawayTypeID = 0xdaad85b0
func (m MessageMediaGiveaway ) construct () MessageMediaClass { return &m }
var (
_ bin .Encoder = &MessageMediaGiveaway {}
_ bin .Decoder = &MessageMediaGiveaway {}
_ bin .BareEncoder = &MessageMediaGiveaway {}
_ bin .BareDecoder = &MessageMediaGiveaway {}
_ MessageMediaClass = &MessageMediaGiveaway {}
)
func (m *MessageMediaGiveaway ) Zero () bool {
if m == nil {
return true
}
if !(m .Flags .Zero ()) {
return false
}
if !(m .OnlyNewSubscribers == false ) {
return false
}
if !(m .WinnersAreVisible == false ) {
return false
}
if !(m .Channels == nil ) {
return false
}
if !(m .CountriesISO2 == nil ) {
return false
}
if !(m .PrizeDescription == "" ) {
return false
}
if !(m .Quantity == 0 ) {
return false
}
if !(m .Months == 0 ) {
return false
}
if !(m .UntilDate == 0 ) {
return false
}
return true
}
func (m *MessageMediaGiveaway ) String () string {
if m == nil {
return "MessageMediaGiveaway(nil)"
}
type Alias MessageMediaGiveaway
return fmt .Sprintf ("MessageMediaGiveaway%+v" , Alias (*m ))
}
func (m *MessageMediaGiveaway ) FillFrom (from interface {
GetOnlyNewSubscribers () (value bool )
GetWinnersAreVisible () (value bool )
GetChannels () (value []int64 )
GetCountriesISO2 () (value []string , ok bool )
GetPrizeDescription () (value string , ok bool )
GetQuantity () (value int )
GetMonths () (value int )
GetUntilDate () (value int )
}) {
m .OnlyNewSubscribers = from .GetOnlyNewSubscribers ()
m .WinnersAreVisible = from .GetWinnersAreVisible ()
m .Channels = from .GetChannels ()
if val , ok := from .GetCountriesISO2 (); ok {
m .CountriesISO2 = val
}
if val , ok := from .GetPrizeDescription (); ok {
m .PrizeDescription = val
}
m .Quantity = from .GetQuantity ()
m .Months = from .GetMonths ()
m .UntilDate = from .GetUntilDate ()
}
func (*MessageMediaGiveaway ) TypeID () uint32 {
return MessageMediaGiveawayTypeID
}
func (*MessageMediaGiveaway ) TypeName () string {
return "messageMediaGiveaway"
}
func (m *MessageMediaGiveaway ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messageMediaGiveaway" ,
ID : MessageMediaGiveawayTypeID ,
}
if m == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "OnlyNewSubscribers" ,
SchemaName : "only_new_subscribers" ,
Null : !m .Flags .Has (0 ),
},
{
Name : "WinnersAreVisible" ,
SchemaName : "winners_are_visible" ,
Null : !m .Flags .Has (2 ),
},
{
Name : "Channels" ,
SchemaName : "channels" ,
},
{
Name : "CountriesISO2" ,
SchemaName : "countries_iso2" ,
Null : !m .Flags .Has (1 ),
},
{
Name : "PrizeDescription" ,
SchemaName : "prize_description" ,
Null : !m .Flags .Has (3 ),
},
{
Name : "Quantity" ,
SchemaName : "quantity" ,
},
{
Name : "Months" ,
SchemaName : "months" ,
},
{
Name : "UntilDate" ,
SchemaName : "until_date" ,
},
}
return typ
}
func (m *MessageMediaGiveaway ) SetFlags () {
if !(m .OnlyNewSubscribers == false ) {
m .Flags .Set (0 )
}
if !(m .WinnersAreVisible == false ) {
m .Flags .Set (2 )
}
if !(m .CountriesISO2 == nil ) {
m .Flags .Set (1 )
}
if !(m .PrizeDescription == "" ) {
m .Flags .Set (3 )
}
}
func (m *MessageMediaGiveaway ) Encode (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't encode messageMediaGiveaway#daad85b0 as nil" )
}
b .PutID (MessageMediaGiveawayTypeID )
return m .EncodeBare (b )
}
func (m *MessageMediaGiveaway ) EncodeBare (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't encode messageMediaGiveaway#daad85b0 as nil" )
}
m .SetFlags ()
if err := m .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messageMediaGiveaway#daad85b0: field flags: %w" , err )
}
b .PutVectorHeader (len (m .Channels ))
for _ , v := range m .Channels {
b .PutLong (v )
}
if m .Flags .Has (1 ) {
b .PutVectorHeader (len (m .CountriesISO2 ))
for _ , v := range m .CountriesISO2 {
b .PutString (v )
}
}
if m .Flags .Has (3 ) {
b .PutString (m .PrizeDescription )
}
b .PutInt (m .Quantity )
b .PutInt (m .Months )
b .PutInt (m .UntilDate )
return nil
}
func (m *MessageMediaGiveaway ) Decode (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't decode messageMediaGiveaway#daad85b0 to nil" )
}
if err := b .ConsumeID (MessageMediaGiveawayTypeID ); err != nil {
return fmt .Errorf ("unable to decode messageMediaGiveaway#daad85b0: %w" , err )
}
return m .DecodeBare (b )
}
func (m *MessageMediaGiveaway ) DecodeBare (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't decode messageMediaGiveaway#daad85b0 to nil" )
}
{
if err := m .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode messageMediaGiveaway#daad85b0: field flags: %w" , err )
}
}
m .OnlyNewSubscribers = m .Flags .Has (0 )
m .WinnersAreVisible = m .Flags .Has (2 )
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode messageMediaGiveaway#daad85b0: field channels: %w" , err )
}
if headerLen > 0 {
m .Channels = make ([]int64 , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode messageMediaGiveaway#daad85b0: field channels: %w" , err )
}
m .Channels = append (m .Channels , value )
}
}
if m .Flags .Has (1 ) {
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode messageMediaGiveaway#daad85b0: field countries_iso2: %w" , err )
}
if headerLen > 0 {
m .CountriesISO2 = make ([]string , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode messageMediaGiveaway#daad85b0: field countries_iso2: %w" , err )
}
m .CountriesISO2 = append (m .CountriesISO2 , value )
}
}
if m .Flags .Has (3 ) {
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode messageMediaGiveaway#daad85b0: field prize_description: %w" , err )
}
m .PrizeDescription = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode messageMediaGiveaway#daad85b0: field quantity: %w" , err )
}
m .Quantity = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode messageMediaGiveaway#daad85b0: field months: %w" , err )
}
m .Months = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode messageMediaGiveaway#daad85b0: field until_date: %w" , err )
}
m .UntilDate = value
}
return nil
}
func (m *MessageMediaGiveaway ) SetOnlyNewSubscribers (value bool ) {
if value {
m .Flags .Set (0 )
m .OnlyNewSubscribers = true
} else {
m .Flags .Unset (0 )
m .OnlyNewSubscribers = false
}
}
func (m *MessageMediaGiveaway ) GetOnlyNewSubscribers () (value bool ) {
if m == nil {
return
}
return m .Flags .Has (0 )
}
func (m *MessageMediaGiveaway ) SetWinnersAreVisible (value bool ) {
if value {
m .Flags .Set (2 )
m .WinnersAreVisible = true
} else {
m .Flags .Unset (2 )
m .WinnersAreVisible = false
}
}
func (m *MessageMediaGiveaway ) GetWinnersAreVisible () (value bool ) {
if m == nil {
return
}
return m .Flags .Has (2 )
}
func (m *MessageMediaGiveaway ) GetChannels () (value []int64 ) {
if m == nil {
return
}
return m .Channels
}
func (m *MessageMediaGiveaway ) SetCountriesISO2 (value []string ) {
m .Flags .Set (1 )
m .CountriesISO2 = value
}
func (m *MessageMediaGiveaway ) GetCountriesISO2 () (value []string , ok bool ) {
if m == nil {
return
}
if !m .Flags .Has (1 ) {
return value , false
}
return m .CountriesISO2 , true
}
func (m *MessageMediaGiveaway ) SetPrizeDescription (value string ) {
m .Flags .Set (3 )
m .PrizeDescription = value
}
func (m *MessageMediaGiveaway ) GetPrizeDescription () (value string , ok bool ) {
if m == nil {
return
}
if !m .Flags .Has (3 ) {
return value , false
}
return m .PrizeDescription , true
}
func (m *MessageMediaGiveaway ) GetQuantity () (value int ) {
if m == nil {
return
}
return m .Quantity
}
func (m *MessageMediaGiveaway ) GetMonths () (value int ) {
if m == nil {
return
}
return m .Months
}
func (m *MessageMediaGiveaway ) GetUntilDate () (value int ) {
if m == nil {
return
}
return m .UntilDate
}
type MessageMediaGiveawayResults struct {
Flags bin .Fields
OnlyNewSubscribers bool
Refunded bool
ChannelID int64
AdditionalPeersCount int
LaunchMsgID int
WinnersCount int
UnclaimedCount int
Winners []int64
Months int
PrizeDescription string
UntilDate int
}
const MessageMediaGiveawayResultsTypeID = 0xc6991068
func (m MessageMediaGiveawayResults ) construct () MessageMediaClass { return &m }
var (
_ bin .Encoder = &MessageMediaGiveawayResults {}
_ bin .Decoder = &MessageMediaGiveawayResults {}
_ bin .BareEncoder = &MessageMediaGiveawayResults {}
_ bin .BareDecoder = &MessageMediaGiveawayResults {}
_ MessageMediaClass = &MessageMediaGiveawayResults {}
)
func (m *MessageMediaGiveawayResults ) Zero () bool {
if m == nil {
return true
}
if !(m .Flags .Zero ()) {
return false
}
if !(m .OnlyNewSubscribers == false ) {
return false
}
if !(m .Refunded == false ) {
return false
}
if !(m .ChannelID == 0 ) {
return false
}
if !(m .AdditionalPeersCount == 0 ) {
return false
}
if !(m .LaunchMsgID == 0 ) {
return false
}
if !(m .WinnersCount == 0 ) {
return false
}
if !(m .UnclaimedCount == 0 ) {
return false
}
if !(m .Winners == nil ) {
return false
}
if !(m .Months == 0 ) {
return false
}
if !(m .PrizeDescription == "" ) {
return false
}
if !(m .UntilDate == 0 ) {
return false
}
return true
}
func (m *MessageMediaGiveawayResults ) String () string {
if m == nil {
return "MessageMediaGiveawayResults(nil)"
}
type Alias MessageMediaGiveawayResults
return fmt .Sprintf ("MessageMediaGiveawayResults%+v" , Alias (*m ))
}
func (m *MessageMediaGiveawayResults ) FillFrom (from interface {
GetOnlyNewSubscribers () (value bool )
GetRefunded () (value bool )
GetChannelID () (value int64 )
GetAdditionalPeersCount () (value int , ok bool )
GetLaunchMsgID () (value int )
GetWinnersCount () (value int )
GetUnclaimedCount () (value int )
GetWinners () (value []int64 )
GetMonths () (value int )
GetPrizeDescription () (value string , ok bool )
GetUntilDate () (value int )
}) {
m .OnlyNewSubscribers = from .GetOnlyNewSubscribers ()
m .Refunded = from .GetRefunded ()
m .ChannelID = from .GetChannelID ()
if val , ok := from .GetAdditionalPeersCount (); ok {
m .AdditionalPeersCount = val
}
m .LaunchMsgID = from .GetLaunchMsgID ()
m .WinnersCount = from .GetWinnersCount ()
m .UnclaimedCount = from .GetUnclaimedCount ()
m .Winners = from .GetWinners ()
m .Months = from .GetMonths ()
if val , ok := from .GetPrizeDescription (); ok {
m .PrizeDescription = val
}
m .UntilDate = from .GetUntilDate ()
}
func (*MessageMediaGiveawayResults ) TypeID () uint32 {
return MessageMediaGiveawayResultsTypeID
}
func (*MessageMediaGiveawayResults ) TypeName () string {
return "messageMediaGiveawayResults"
}
func (m *MessageMediaGiveawayResults ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messageMediaGiveawayResults" ,
ID : MessageMediaGiveawayResultsTypeID ,
}
if m == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "OnlyNewSubscribers" ,
SchemaName : "only_new_subscribers" ,
Null : !m .Flags .Has (0 ),
},
{
Name : "Refunded" ,
SchemaName : "refunded" ,
Null : !m .Flags .Has (2 ),
},
{
Name : "ChannelID" ,
SchemaName : "channel_id" ,
},
{
Name : "AdditionalPeersCount" ,
SchemaName : "additional_peers_count" ,
Null : !m .Flags .Has (3 ),
},
{
Name : "LaunchMsgID" ,
SchemaName : "launch_msg_id" ,
},
{
Name : "WinnersCount" ,
SchemaName : "winners_count" ,
},
{
Name : "UnclaimedCount" ,
SchemaName : "unclaimed_count" ,
},
{
Name : "Winners" ,
SchemaName : "winners" ,
},
{
Name : "Months" ,
SchemaName : "months" ,
},
{
Name : "PrizeDescription" ,
SchemaName : "prize_description" ,
Null : !m .Flags .Has (1 ),
},
{
Name : "UntilDate" ,
SchemaName : "until_date" ,
},
}
return typ
}
func (m *MessageMediaGiveawayResults ) SetFlags () {
if !(m .OnlyNewSubscribers == false ) {
m .Flags .Set (0 )
}
if !(m .Refunded == false ) {
m .Flags .Set (2 )
}
if !(m .AdditionalPeersCount == 0 ) {
m .Flags .Set (3 )
}
if !(m .PrizeDescription == "" ) {
m .Flags .Set (1 )
}
}
func (m *MessageMediaGiveawayResults ) Encode (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't encode messageMediaGiveawayResults#c6991068 as nil" )
}
b .PutID (MessageMediaGiveawayResultsTypeID )
return m .EncodeBare (b )
}
func (m *MessageMediaGiveawayResults ) EncodeBare (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't encode messageMediaGiveawayResults#c6991068 as nil" )
}
m .SetFlags ()
if err := m .Flags .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode messageMediaGiveawayResults#c6991068: field flags: %w" , err )
}
b .PutLong (m .ChannelID )
if m .Flags .Has (3 ) {
b .PutInt (m .AdditionalPeersCount )
}
b .PutInt (m .LaunchMsgID )
b .PutInt (m .WinnersCount )
b .PutInt (m .UnclaimedCount )
b .PutVectorHeader (len (m .Winners ))
for _ , v := range m .Winners {
b .PutLong (v )
}
b .PutInt (m .Months )
if m .Flags .Has (1 ) {
b .PutString (m .PrizeDescription )
}
b .PutInt (m .UntilDate )
return nil
}
func (m *MessageMediaGiveawayResults ) Decode (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't decode messageMediaGiveawayResults#c6991068 to nil" )
}
if err := b .ConsumeID (MessageMediaGiveawayResultsTypeID ); err != nil {
return fmt .Errorf ("unable to decode messageMediaGiveawayResults#c6991068: %w" , err )
}
return m .DecodeBare (b )
}
func (m *MessageMediaGiveawayResults ) DecodeBare (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't decode messageMediaGiveawayResults#c6991068 to nil" )
}
{
if err := m .Flags .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode messageMediaGiveawayResults#c6991068: field flags: %w" , err )
}
}
m .OnlyNewSubscribers = m .Flags .Has (0 )
m .Refunded = m .Flags .Has (2 )
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode messageMediaGiveawayResults#c6991068: field channel_id: %w" , err )
}
m .ChannelID = value
}
if m .Flags .Has (3 ) {
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode messageMediaGiveawayResults#c6991068: field additional_peers_count: %w" , err )
}
m .AdditionalPeersCount = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode messageMediaGiveawayResults#c6991068: field launch_msg_id: %w" , err )
}
m .LaunchMsgID = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode messageMediaGiveawayResults#c6991068: field winners_count: %w" , err )
}
m .WinnersCount = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode messageMediaGiveawayResults#c6991068: field unclaimed_count: %w" , err )
}
m .UnclaimedCount = value
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode messageMediaGiveawayResults#c6991068: field winners: %w" , err )
}
if headerLen > 0 {
m .Winners = make ([]int64 , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode messageMediaGiveawayResults#c6991068: field winners: %w" , err )
}
m .Winners = append (m .Winners , value )
}
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode messageMediaGiveawayResults#c6991068: field months: %w" , err )
}
m .Months = value
}
if m .Flags .Has (1 ) {
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode messageMediaGiveawayResults#c6991068: field prize_description: %w" , err )
}
m .PrizeDescription = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode messageMediaGiveawayResults#c6991068: field until_date: %w" , err )
}
m .UntilDate = value
}
return nil
}
func (m *MessageMediaGiveawayResults ) SetOnlyNewSubscribers (value bool ) {
if value {
m .Flags .Set (0 )
m .OnlyNewSubscribers = true
} else {
m .Flags .Unset (0 )
m .OnlyNewSubscribers = false
}
}
func (m *MessageMediaGiveawayResults ) GetOnlyNewSubscribers () (value bool ) {
if m == nil {
return
}
return m .Flags .Has (0 )
}
func (m *MessageMediaGiveawayResults ) SetRefunded (value bool ) {
if value {
m .Flags .Set (2 )
m .Refunded = true
} else {
m .Flags .Unset (2 )
m .Refunded = false
}
}
func (m *MessageMediaGiveawayResults ) GetRefunded () (value bool ) {
if m == nil {
return
}
return m .Flags .Has (2 )
}
func (m *MessageMediaGiveawayResults ) GetChannelID () (value int64 ) {
if m == nil {
return
}
return m .ChannelID
}
func (m *MessageMediaGiveawayResults ) SetAdditionalPeersCount (value int ) {
m .Flags .Set (3 )
m .AdditionalPeersCount = value
}
func (m *MessageMediaGiveawayResults ) GetAdditionalPeersCount () (value int , ok bool ) {
if m == nil {
return
}
if !m .Flags .Has (3 ) {
return value , false
}
return m .AdditionalPeersCount , true
}
func (m *MessageMediaGiveawayResults ) GetLaunchMsgID () (value int ) {
if m == nil {
return
}
return m .LaunchMsgID
}
func (m *MessageMediaGiveawayResults ) GetWinnersCount () (value int ) {
if m == nil {
return
}
return m .WinnersCount
}
func (m *MessageMediaGiveawayResults ) GetUnclaimedCount () (value int ) {
if m == nil {
return
}
return m .UnclaimedCount
}
func (m *MessageMediaGiveawayResults ) GetWinners () (value []int64 ) {
if m == nil {
return
}
return m .Winners
}
func (m *MessageMediaGiveawayResults ) GetMonths () (value int ) {
if m == nil {
return
}
return m .Months
}
func (m *MessageMediaGiveawayResults ) SetPrizeDescription (value string ) {
m .Flags .Set (1 )
m .PrizeDescription = value
}
func (m *MessageMediaGiveawayResults ) GetPrizeDescription () (value string , ok bool ) {
if m == nil {
return
}
if !m .Flags .Has (1 ) {
return value , false
}
return m .PrizeDescription , true
}
func (m *MessageMediaGiveawayResults ) GetUntilDate () (value int ) {
if m == nil {
return
}
return m .UntilDate
}
const MessageMediaClassName = "MessageMedia"
type MessageMediaClass interface {
bin .Encoder
bin .Decoder
bin .BareEncoder
bin .BareDecoder
construct () MessageMediaClass
TypeID () uint32
TypeName () string
String () string
Zero () bool
}
func DecodeMessageMedia (buf *bin .Buffer ) (MessageMediaClass , error ) {
id , err := buf .PeekID ()
if err != nil {
return nil , err
}
switch id {
case MessageMediaEmptyTypeID :
v := MessageMediaEmpty {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode MessageMediaClass: %w" , err )
}
return &v , nil
case MessageMediaPhotoTypeID :
v := MessageMediaPhoto {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode MessageMediaClass: %w" , err )
}
return &v , nil
case MessageMediaGeoTypeID :
v := MessageMediaGeo {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode MessageMediaClass: %w" , err )
}
return &v , nil
case MessageMediaContactTypeID :
v := MessageMediaContact {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode MessageMediaClass: %w" , err )
}
return &v , nil
case MessageMediaUnsupportedTypeID :
v := MessageMediaUnsupported {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode MessageMediaClass: %w" , err )
}
return &v , nil
case MessageMediaDocumentTypeID :
v := MessageMediaDocument {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode MessageMediaClass: %w" , err )
}
return &v , nil
case MessageMediaWebPageTypeID :
v := MessageMediaWebPage {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode MessageMediaClass: %w" , err )
}
return &v , nil
case MessageMediaVenueTypeID :
v := MessageMediaVenue {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode MessageMediaClass: %w" , err )
}
return &v , nil
case MessageMediaGameTypeID :
v := MessageMediaGame {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode MessageMediaClass: %w" , err )
}
return &v , nil
case MessageMediaInvoiceTypeID :
v := MessageMediaInvoice {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode MessageMediaClass: %w" , err )
}
return &v , nil
case MessageMediaGeoLiveTypeID :
v := MessageMediaGeoLive {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode MessageMediaClass: %w" , err )
}
return &v , nil
case MessageMediaPollTypeID :
v := MessageMediaPoll {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode MessageMediaClass: %w" , err )
}
return &v , nil
case MessageMediaDiceTypeID :
v := MessageMediaDice {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode MessageMediaClass: %w" , err )
}
return &v , nil
case MessageMediaStoryTypeID :
v := MessageMediaStory {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode MessageMediaClass: %w" , err )
}
return &v , nil
case MessageMediaGiveawayTypeID :
v := MessageMediaGiveaway {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode MessageMediaClass: %w" , err )
}
return &v , nil
case MessageMediaGiveawayResultsTypeID :
v := MessageMediaGiveawayResults {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode MessageMediaClass: %w" , err )
}
return &v , nil
default :
return nil , fmt .Errorf ("unable to decode MessageMediaClass: %w" , bin .NewUnexpectedID (id ))
}
}
type MessageMediaBox struct {
MessageMedia MessageMediaClass
}
func (b *MessageMediaBox ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("unable to decode MessageMediaBox to nil" )
}
v , err := DecodeMessageMedia (buf )
if err != nil {
return fmt .Errorf ("unable to decode boxed value: %w" , err )
}
b .MessageMedia = v
return nil
}
func (b *MessageMediaBox ) Encode (buf *bin .Buffer ) error {
if b == nil || b .MessageMedia == nil {
return fmt .Errorf ("unable to encode MessageMediaClass as nil" )
}
return b .MessageMedia .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 .