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,251 @@
|
||||
// Code generated by gotdgen, DO NOT EDIT.
|
||||
|
||||
package tg
|
||||
|
||||
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{}
|
||||
)
|
||||
|
||||
// MaskCoords represents TL type `maskCoords#aed6dbb2`.
|
||||
// Position on a photo where a mask should be placed when attaching stickers to media
|
||||
// »¹
|
||||
// The n position indicates where the mask should be placed:
|
||||
//
|
||||
// Links:
|
||||
// 1. https://core.telegram.org/api/stickers#attached-stickers
|
||||
//
|
||||
// See https://core.telegram.org/constructor/maskCoords for reference.
|
||||
type MaskCoords struct {
|
||||
// Part of the face, relative to which the mask should be placed
|
||||
N int
|
||||
// Shift by X-axis measured in widths of the mask scaled to the face size, from left to
|
||||
// right. (For example, -1.0 will place the mask just to the left of the default mask
|
||||
// position)
|
||||
X float64
|
||||
// Shift by Y-axis measured in widths of the mask scaled to the face size, from left to
|
||||
// right. (For example, -1.0 will place the mask just below the default mask position)
|
||||
Y float64
|
||||
// Mask scaling coefficient. (For example, 2.0 means a doubled size)
|
||||
Zoom float64
|
||||
}
|
||||
|
||||
// MaskCoordsTypeID is TL type id of MaskCoords.
|
||||
const MaskCoordsTypeID = 0xaed6dbb2
|
||||
|
||||
// Ensuring interfaces in compile-time for MaskCoords.
|
||||
var (
|
||||
_ bin.Encoder = &MaskCoords{}
|
||||
_ bin.Decoder = &MaskCoords{}
|
||||
_ bin.BareEncoder = &MaskCoords{}
|
||||
_ bin.BareDecoder = &MaskCoords{}
|
||||
)
|
||||
|
||||
func (m *MaskCoords) Zero() bool {
|
||||
if m == nil {
|
||||
return true
|
||||
}
|
||||
if !(m.N == 0) {
|
||||
return false
|
||||
}
|
||||
if !(m.X == 0) {
|
||||
return false
|
||||
}
|
||||
if !(m.Y == 0) {
|
||||
return false
|
||||
}
|
||||
if !(m.Zoom == 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (m *MaskCoords) String() string {
|
||||
if m == nil {
|
||||
return "MaskCoords(nil)"
|
||||
}
|
||||
type Alias MaskCoords
|
||||
return fmt.Sprintf("MaskCoords%+v", Alias(*m))
|
||||
}
|
||||
|
||||
// FillFrom fills MaskCoords from given interface.
|
||||
func (m *MaskCoords) FillFrom(from interface {
|
||||
GetN() (value int)
|
||||
GetX() (value float64)
|
||||
GetY() (value float64)
|
||||
GetZoom() (value float64)
|
||||
}) {
|
||||
m.N = from.GetN()
|
||||
m.X = from.GetX()
|
||||
m.Y = from.GetY()
|
||||
m.Zoom = from.GetZoom()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*MaskCoords) TypeID() uint32 {
|
||||
return MaskCoordsTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*MaskCoords) TypeName() string {
|
||||
return "maskCoords"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (m *MaskCoords) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "maskCoords",
|
||||
ID: MaskCoordsTypeID,
|
||||
}
|
||||
if m == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "N",
|
||||
SchemaName: "n",
|
||||
},
|
||||
{
|
||||
Name: "X",
|
||||
SchemaName: "x",
|
||||
},
|
||||
{
|
||||
Name: "Y",
|
||||
SchemaName: "y",
|
||||
},
|
||||
{
|
||||
Name: "Zoom",
|
||||
SchemaName: "zoom",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (m *MaskCoords) Encode(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't encode maskCoords#aed6dbb2 as nil")
|
||||
}
|
||||
b.PutID(MaskCoordsTypeID)
|
||||
return m.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (m *MaskCoords) EncodeBare(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't encode maskCoords#aed6dbb2 as nil")
|
||||
}
|
||||
b.PutInt(m.N)
|
||||
b.PutDouble(m.X)
|
||||
b.PutDouble(m.Y)
|
||||
b.PutDouble(m.Zoom)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (m *MaskCoords) Decode(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't decode maskCoords#aed6dbb2 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(MaskCoordsTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode maskCoords#aed6dbb2: %w", err)
|
||||
}
|
||||
return m.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (m *MaskCoords) DecodeBare(b *bin.Buffer) error {
|
||||
if m == nil {
|
||||
return fmt.Errorf("can't decode maskCoords#aed6dbb2 to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode maskCoords#aed6dbb2: field n: %w", err)
|
||||
}
|
||||
m.N = value
|
||||
}
|
||||
{
|
||||
value, err := b.Double()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode maskCoords#aed6dbb2: field x: %w", err)
|
||||
}
|
||||
m.X = value
|
||||
}
|
||||
{
|
||||
value, err := b.Double()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode maskCoords#aed6dbb2: field y: %w", err)
|
||||
}
|
||||
m.Y = value
|
||||
}
|
||||
{
|
||||
value, err := b.Double()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode maskCoords#aed6dbb2: field zoom: %w", err)
|
||||
}
|
||||
m.Zoom = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetN returns value of N field.
|
||||
func (m *MaskCoords) GetN() (value int) {
|
||||
if m == nil {
|
||||
return
|
||||
}
|
||||
return m.N
|
||||
}
|
||||
|
||||
// GetX returns value of X field.
|
||||
func (m *MaskCoords) GetX() (value float64) {
|
||||
if m == nil {
|
||||
return
|
||||
}
|
||||
return m.X
|
||||
}
|
||||
|
||||
// GetY returns value of Y field.
|
||||
func (m *MaskCoords) GetY() (value float64) {
|
||||
if m == nil {
|
||||
return
|
||||
}
|
||||
return m.Y
|
||||
}
|
||||
|
||||
// GetZoom returns value of Zoom field.
|
||||
func (m *MaskCoords) GetZoom() (value float64) {
|
||||
if m == nil {
|
||||
return
|
||||
}
|
||||
return m.Zoom
|
||||
}
|
||||
Reference in New Issue
Block a user