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 QuickReply struct {
ShortcutID int
Shortcut string
TopMessage int
Count int
}
const QuickReplyTypeID = 0x697102b
var (
_ bin .Encoder = &QuickReply {}
_ bin .Decoder = &QuickReply {}
_ bin .BareEncoder = &QuickReply {}
_ bin .BareDecoder = &QuickReply {}
)
func (q *QuickReply ) Zero () bool {
if q == nil {
return true
}
if !(q .ShortcutID == 0 ) {
return false
}
if !(q .Shortcut == "" ) {
return false
}
if !(q .TopMessage == 0 ) {
return false
}
if !(q .Count == 0 ) {
return false
}
return true
}
func (q *QuickReply ) String () string {
if q == nil {
return "QuickReply(nil)"
}
type Alias QuickReply
return fmt .Sprintf ("QuickReply%+v" , Alias (*q ))
}
func (q *QuickReply ) FillFrom (from interface {
GetShortcutID () (value int )
GetShortcut () (value string )
GetTopMessage () (value int )
GetCount () (value int )
}) {
q .ShortcutID = from .GetShortcutID ()
q .Shortcut = from .GetShortcut ()
q .TopMessage = from .GetTopMessage ()
q .Count = from .GetCount ()
}
func (*QuickReply ) TypeID () uint32 {
return QuickReplyTypeID
}
func (*QuickReply ) TypeName () string {
return "quickReply"
}
func (q *QuickReply ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "quickReply" ,
ID : QuickReplyTypeID ,
}
if q == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "ShortcutID" ,
SchemaName : "shortcut_id" ,
},
{
Name : "Shortcut" ,
SchemaName : "shortcut" ,
},
{
Name : "TopMessage" ,
SchemaName : "top_message" ,
},
{
Name : "Count" ,
SchemaName : "count" ,
},
}
return typ
}
func (q *QuickReply ) Encode (b *bin .Buffer ) error {
if q == nil {
return fmt .Errorf ("can't encode quickReply#697102b as nil" )
}
b .PutID (QuickReplyTypeID )
return q .EncodeBare (b )
}
func (q *QuickReply ) EncodeBare (b *bin .Buffer ) error {
if q == nil {
return fmt .Errorf ("can't encode quickReply#697102b as nil" )
}
b .PutInt (q .ShortcutID )
b .PutString (q .Shortcut )
b .PutInt (q .TopMessage )
b .PutInt (q .Count )
return nil
}
func (q *QuickReply ) Decode (b *bin .Buffer ) error {
if q == nil {
return fmt .Errorf ("can't decode quickReply#697102b to nil" )
}
if err := b .ConsumeID (QuickReplyTypeID ); err != nil {
return fmt .Errorf ("unable to decode quickReply#697102b: %w" , err )
}
return q .DecodeBare (b )
}
func (q *QuickReply ) DecodeBare (b *bin .Buffer ) error {
if q == nil {
return fmt .Errorf ("can't decode quickReply#697102b to nil" )
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode quickReply#697102b: field shortcut_id: %w" , err )
}
q .ShortcutID = value
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode quickReply#697102b: field shortcut: %w" , err )
}
q .Shortcut = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode quickReply#697102b: field top_message: %w" , err )
}
q .TopMessage = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode quickReply#697102b: field count: %w" , err )
}
q .Count = value
}
return nil
}
func (q *QuickReply ) GetShortcutID () (value int ) {
if q == nil {
return
}
return q .ShortcutID
}
func (q *QuickReply ) GetShortcut () (value string ) {
if q == nil {
return
}
return q .Shortcut
}
func (q *QuickReply ) GetTopMessage () (value int ) {
if q == nil {
return
}
return q .TopMessage
}
func (q *QuickReply ) GetCount () (value int ) {
if q == nil {
return
}
return q .Count
}
The pages are generated with Golds v0.8.4 . (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu .
PR and bug reports are welcome and can be submitted to the issue list .
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds .