move gotd fork into repo. (#111)
- update to latest telegram layer - remove some references to fields in tg.Entities that don't exist in the schema - originally added here: https://github.com/beeper/td/commit/820929062a2ba0104397bc01235ab58a9cff780e - referenced here - https://github.com/mautrix/telegramgo/commit/124f0967ed195b5a380c9bd02e170ada9710dde3 - https://github.com/mautrix/telegramgo/commit/4205047aab2e0639217148b5d125bfaab668bd8e
This commit is contained in:
@@ -0,0 +1,177 @@
|
||||
// Code generated by gotdgen, DO NOT EDIT.
|
||||
|
||||
package mt
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"go.uber.org/multierr"
|
||||
|
||||
"go.mau.fi/mautrix-telegram/pkg/gotd/bin"
|
||||
"go.mau.fi/mautrix-telegram/pkg/gotd/tdjson"
|
||||
"go.mau.fi/mautrix-telegram/pkg/gotd/tdp"
|
||||
"go.mau.fi/mautrix-telegram/pkg/gotd/tgerr"
|
||||
)
|
||||
|
||||
// No-op definition for keeping imports.
|
||||
var (
|
||||
_ = bin.Buffer{}
|
||||
_ = context.Background()
|
||||
_ = fmt.Stringer(nil)
|
||||
_ = strings.Builder{}
|
||||
_ = errors.Is
|
||||
_ = multierr.AppendInto
|
||||
_ = sort.Ints
|
||||
_ = tdp.Format
|
||||
_ = tgerr.Error{}
|
||||
_ = tdjson.Encoder{}
|
||||
)
|
||||
|
||||
// Pong represents TL type `pong#347773c5`.
|
||||
type Pong struct {
|
||||
// MsgID field of Pong.
|
||||
MsgID int64
|
||||
// PingID field of Pong.
|
||||
PingID int64
|
||||
}
|
||||
|
||||
// PongTypeID is TL type id of Pong.
|
||||
const PongTypeID = 0x347773c5
|
||||
|
||||
// Ensuring interfaces in compile-time for Pong.
|
||||
var (
|
||||
_ bin.Encoder = &Pong{}
|
||||
_ bin.Decoder = &Pong{}
|
||||
_ bin.BareEncoder = &Pong{}
|
||||
_ bin.BareDecoder = &Pong{}
|
||||
)
|
||||
|
||||
func (p *Pong) Zero() bool {
|
||||
if p == nil {
|
||||
return true
|
||||
}
|
||||
if !(p.MsgID == 0) {
|
||||
return false
|
||||
}
|
||||
if !(p.PingID == 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (p *Pong) String() string {
|
||||
if p == nil {
|
||||
return "Pong(nil)"
|
||||
}
|
||||
type Alias Pong
|
||||
return fmt.Sprintf("Pong%+v", Alias(*p))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*Pong) TypeID() uint32 {
|
||||
return PongTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*Pong) TypeName() string {
|
||||
return "pong"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (p *Pong) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "pong",
|
||||
ID: PongTypeID,
|
||||
}
|
||||
if p == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "MsgID",
|
||||
SchemaName: "msg_id",
|
||||
},
|
||||
{
|
||||
Name: "PingID",
|
||||
SchemaName: "ping_id",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (p *Pong) Encode(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't encode pong#347773c5 as nil")
|
||||
}
|
||||
b.PutID(PongTypeID)
|
||||
return p.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (p *Pong) EncodeBare(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't encode pong#347773c5 as nil")
|
||||
}
|
||||
b.PutLong(p.MsgID)
|
||||
b.PutLong(p.PingID)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (p *Pong) Decode(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't decode pong#347773c5 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(PongTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode pong#347773c5: %w", err)
|
||||
}
|
||||
return p.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (p *Pong) DecodeBare(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't decode pong#347773c5 to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode pong#347773c5: field msg_id: %w", err)
|
||||
}
|
||||
p.MsgID = value
|
||||
}
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode pong#347773c5: field ping_id: %w", err)
|
||||
}
|
||||
p.PingID = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetMsgID returns value of MsgID field.
|
||||
func (p *Pong) GetMsgID() (value int64) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
return p.MsgID
|
||||
}
|
||||
|
||||
// GetPingID returns value of PingID field.
|
||||
func (p *Pong) GetPingID() (value int64) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
return p.PingID
|
||||
}
|
||||
Reference in New Issue
Block a user