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 BotInlineMessageClassArray []BotInlineMessageClass
func (s BotInlineMessageClassArray ) Sort (less func (a , b BotInlineMessageClass ) bool ) BotInlineMessageClassArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s BotInlineMessageClassArray ) SortStable (less func (a , b BotInlineMessageClass ) bool ) BotInlineMessageClassArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s BotInlineMessageClassArray ) Retain (keep func (x BotInlineMessageClass ) bool ) BotInlineMessageClassArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s BotInlineMessageClassArray ) First () (v BotInlineMessageClass , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s BotInlineMessageClassArray ) Last () (v BotInlineMessageClass , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *BotInlineMessageClassArray ) PopFirst () (v BotInlineMessageClass , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero BotInlineMessageClass
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *BotInlineMessageClassArray ) Pop () (v BotInlineMessageClass , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [len (a )-1 ]
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s BotInlineMessageClassArray ) AsBotInlineMessageMediaAuto () (to BotInlineMessageMediaAutoArray ) {
for _ , elem := range s {
value , ok := elem .(*BotInlineMessageMediaAuto )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s BotInlineMessageClassArray ) AsBotInlineMessageText () (to BotInlineMessageTextArray ) {
for _ , elem := range s {
value , ok := elem .(*BotInlineMessageText )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s BotInlineMessageClassArray ) AsBotInlineMessageMediaGeo () (to BotInlineMessageMediaGeoArray ) {
for _ , elem := range s {
value , ok := elem .(*BotInlineMessageMediaGeo )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s BotInlineMessageClassArray ) AsBotInlineMessageMediaVenue () (to BotInlineMessageMediaVenueArray ) {
for _ , elem := range s {
value , ok := elem .(*BotInlineMessageMediaVenue )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s BotInlineMessageClassArray ) AsBotInlineMessageMediaContact () (to BotInlineMessageMediaContactArray ) {
for _ , elem := range s {
value , ok := elem .(*BotInlineMessageMediaContact )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s BotInlineMessageClassArray ) AsBotInlineMessageMediaInvoice () (to BotInlineMessageMediaInvoiceArray ) {
for _ , elem := range s {
value , ok := elem .(*BotInlineMessageMediaInvoice )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s BotInlineMessageClassArray ) AsBotInlineMessageMediaWebPage () (to BotInlineMessageMediaWebPageArray ) {
for _ , elem := range s {
value , ok := elem .(*BotInlineMessageMediaWebPage )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
type BotInlineMessageMediaAutoArray []BotInlineMessageMediaAuto
func (s BotInlineMessageMediaAutoArray ) Sort (less func (a , b BotInlineMessageMediaAuto ) bool ) BotInlineMessageMediaAutoArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s BotInlineMessageMediaAutoArray ) SortStable (less func (a , b BotInlineMessageMediaAuto ) bool ) BotInlineMessageMediaAutoArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s BotInlineMessageMediaAutoArray ) Retain (keep func (x BotInlineMessageMediaAuto ) bool ) BotInlineMessageMediaAutoArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s BotInlineMessageMediaAutoArray ) First () (v BotInlineMessageMediaAuto , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s BotInlineMessageMediaAutoArray ) Last () (v BotInlineMessageMediaAuto , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *BotInlineMessageMediaAutoArray ) PopFirst () (v BotInlineMessageMediaAuto , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero BotInlineMessageMediaAuto
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *BotInlineMessageMediaAutoArray ) Pop () (v BotInlineMessageMediaAuto , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [len (a )-1 ]
a = a [:len (a )-1 ]
*s = a
return v , true
}
type BotInlineMessageTextArray []BotInlineMessageText
func (s BotInlineMessageTextArray ) Sort (less func (a , b BotInlineMessageText ) bool ) BotInlineMessageTextArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s BotInlineMessageTextArray ) SortStable (less func (a , b BotInlineMessageText ) bool ) BotInlineMessageTextArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s BotInlineMessageTextArray ) Retain (keep func (x BotInlineMessageText ) bool ) BotInlineMessageTextArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s BotInlineMessageTextArray ) First () (v BotInlineMessageText , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s BotInlineMessageTextArray ) Last () (v BotInlineMessageText , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *BotInlineMessageTextArray ) PopFirst () (v BotInlineMessageText , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero BotInlineMessageText
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *BotInlineMessageTextArray ) Pop () (v BotInlineMessageText , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [len (a )-1 ]
a = a [:len (a )-1 ]
*s = a
return v , true
}
type BotInlineMessageMediaGeoArray []BotInlineMessageMediaGeo
func (s BotInlineMessageMediaGeoArray ) Sort (less func (a , b BotInlineMessageMediaGeo ) bool ) BotInlineMessageMediaGeoArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s BotInlineMessageMediaGeoArray ) SortStable (less func (a , b BotInlineMessageMediaGeo ) bool ) BotInlineMessageMediaGeoArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s BotInlineMessageMediaGeoArray ) Retain (keep func (x BotInlineMessageMediaGeo ) bool ) BotInlineMessageMediaGeoArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s BotInlineMessageMediaGeoArray ) First () (v BotInlineMessageMediaGeo , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s BotInlineMessageMediaGeoArray ) Last () (v BotInlineMessageMediaGeo , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *BotInlineMessageMediaGeoArray ) PopFirst () (v BotInlineMessageMediaGeo , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero BotInlineMessageMediaGeo
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *BotInlineMessageMediaGeoArray ) Pop () (v BotInlineMessageMediaGeo , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [len (a )-1 ]
a = a [:len (a )-1 ]
*s = a
return v , true
}
type BotInlineMessageMediaVenueArray []BotInlineMessageMediaVenue
func (s BotInlineMessageMediaVenueArray ) Sort (less func (a , b BotInlineMessageMediaVenue ) bool ) BotInlineMessageMediaVenueArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s BotInlineMessageMediaVenueArray ) SortStable (less func (a , b BotInlineMessageMediaVenue ) bool ) BotInlineMessageMediaVenueArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s BotInlineMessageMediaVenueArray ) Retain (keep func (x BotInlineMessageMediaVenue ) bool ) BotInlineMessageMediaVenueArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s BotInlineMessageMediaVenueArray ) First () (v BotInlineMessageMediaVenue , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s BotInlineMessageMediaVenueArray ) Last () (v BotInlineMessageMediaVenue , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *BotInlineMessageMediaVenueArray ) PopFirst () (v BotInlineMessageMediaVenue , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero BotInlineMessageMediaVenue
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *BotInlineMessageMediaVenueArray ) Pop () (v BotInlineMessageMediaVenue , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [len (a )-1 ]
a = a [:len (a )-1 ]
*s = a
return v , true
}
type BotInlineMessageMediaContactArray []BotInlineMessageMediaContact
func (s BotInlineMessageMediaContactArray ) Sort (less func (a , b BotInlineMessageMediaContact ) bool ) BotInlineMessageMediaContactArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s BotInlineMessageMediaContactArray ) SortStable (less func (a , b BotInlineMessageMediaContact ) bool ) BotInlineMessageMediaContactArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s BotInlineMessageMediaContactArray ) Retain (keep func (x BotInlineMessageMediaContact ) bool ) BotInlineMessageMediaContactArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s BotInlineMessageMediaContactArray ) First () (v BotInlineMessageMediaContact , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s BotInlineMessageMediaContactArray ) Last () (v BotInlineMessageMediaContact , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *BotInlineMessageMediaContactArray ) PopFirst () (v BotInlineMessageMediaContact , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero BotInlineMessageMediaContact
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *BotInlineMessageMediaContactArray ) Pop () (v BotInlineMessageMediaContact , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [len (a )-1 ]
a = a [:len (a )-1 ]
*s = a
return v , true
}
type BotInlineMessageMediaInvoiceArray []BotInlineMessageMediaInvoice
func (s BotInlineMessageMediaInvoiceArray ) Sort (less func (a , b BotInlineMessageMediaInvoice ) bool ) BotInlineMessageMediaInvoiceArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s BotInlineMessageMediaInvoiceArray ) SortStable (less func (a , b BotInlineMessageMediaInvoice ) bool ) BotInlineMessageMediaInvoiceArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s BotInlineMessageMediaInvoiceArray ) Retain (keep func (x BotInlineMessageMediaInvoice ) bool ) BotInlineMessageMediaInvoiceArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s BotInlineMessageMediaInvoiceArray ) First () (v BotInlineMessageMediaInvoice , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s BotInlineMessageMediaInvoiceArray ) Last () (v BotInlineMessageMediaInvoice , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *BotInlineMessageMediaInvoiceArray ) PopFirst () (v BotInlineMessageMediaInvoice , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero BotInlineMessageMediaInvoice
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *BotInlineMessageMediaInvoiceArray ) Pop () (v BotInlineMessageMediaInvoice , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [len (a )-1 ]
a = a [:len (a )-1 ]
*s = a
return v , true
}
type BotInlineMessageMediaWebPageArray []BotInlineMessageMediaWebPage
func (s BotInlineMessageMediaWebPageArray ) Sort (less func (a , b BotInlineMessageMediaWebPage ) bool ) BotInlineMessageMediaWebPageArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s BotInlineMessageMediaWebPageArray ) SortStable (less func (a , b BotInlineMessageMediaWebPage ) bool ) BotInlineMessageMediaWebPageArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s BotInlineMessageMediaWebPageArray ) Retain (keep func (x BotInlineMessageMediaWebPage ) bool ) BotInlineMessageMediaWebPageArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s BotInlineMessageMediaWebPageArray ) First () (v BotInlineMessageMediaWebPage , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s BotInlineMessageMediaWebPageArray ) Last () (v BotInlineMessageMediaWebPage , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *BotInlineMessageMediaWebPageArray ) PopFirst () (v BotInlineMessageMediaWebPage , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero BotInlineMessageMediaWebPage
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *BotInlineMessageMediaWebPageArray ) Pop () (v BotInlineMessageMediaWebPage , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [len (a )-1 ]
a = a [:len (a )-1 ]
*s = a
return v , true
}
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 .