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:
Adam Van Ymeren
2025-06-27 20:03:37 -07:00
committed by GitHub
parent 0952df0244
commit 7a04f298d2
19264 changed files with 1539697 additions and 84 deletions
+242
View File
@@ -0,0 +1,242 @@
// 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{}
)
// PendingSuggestion represents TL type `pendingSuggestion#e7e82e12`.
//
// See https://core.telegram.org/constructor/pendingSuggestion for reference.
type PendingSuggestion struct {
// Suggestion field of PendingSuggestion.
Suggestion string
// Title field of PendingSuggestion.
Title TextWithEntities
// Description field of PendingSuggestion.
Description TextWithEntities
// URL field of PendingSuggestion.
URL string
}
// PendingSuggestionTypeID is TL type id of PendingSuggestion.
const PendingSuggestionTypeID = 0xe7e82e12
// Ensuring interfaces in compile-time for PendingSuggestion.
var (
_ bin.Encoder = &PendingSuggestion{}
_ bin.Decoder = &PendingSuggestion{}
_ bin.BareEncoder = &PendingSuggestion{}
_ bin.BareDecoder = &PendingSuggestion{}
)
func (p *PendingSuggestion) Zero() bool {
if p == nil {
return true
}
if !(p.Suggestion == "") {
return false
}
if !(p.Title.Zero()) {
return false
}
if !(p.Description.Zero()) {
return false
}
if !(p.URL == "") {
return false
}
return true
}
// String implements fmt.Stringer.
func (p *PendingSuggestion) String() string {
if p == nil {
return "PendingSuggestion(nil)"
}
type Alias PendingSuggestion
return fmt.Sprintf("PendingSuggestion%+v", Alias(*p))
}
// FillFrom fills PendingSuggestion from given interface.
func (p *PendingSuggestion) FillFrom(from interface {
GetSuggestion() (value string)
GetTitle() (value TextWithEntities)
GetDescription() (value TextWithEntities)
GetURL() (value string)
}) {
p.Suggestion = from.GetSuggestion()
p.Title = from.GetTitle()
p.Description = from.GetDescription()
p.URL = from.GetURL()
}
// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*PendingSuggestion) TypeID() uint32 {
return PendingSuggestionTypeID
}
// TypeName returns name of type in TL schema.
func (*PendingSuggestion) TypeName() string {
return "pendingSuggestion"
}
// TypeInfo returns info about TL type.
func (p *PendingSuggestion) TypeInfo() tdp.Type {
typ := tdp.Type{
Name: "pendingSuggestion",
ID: PendingSuggestionTypeID,
}
if p == nil {
typ.Null = true
return typ
}
typ.Fields = []tdp.Field{
{
Name: "Suggestion",
SchemaName: "suggestion",
},
{
Name: "Title",
SchemaName: "title",
},
{
Name: "Description",
SchemaName: "description",
},
{
Name: "URL",
SchemaName: "url",
},
}
return typ
}
// Encode implements bin.Encoder.
func (p *PendingSuggestion) Encode(b *bin.Buffer) error {
if p == nil {
return fmt.Errorf("can't encode pendingSuggestion#e7e82e12 as nil")
}
b.PutID(PendingSuggestionTypeID)
return p.EncodeBare(b)
}
// EncodeBare implements bin.BareEncoder.
func (p *PendingSuggestion) EncodeBare(b *bin.Buffer) error {
if p == nil {
return fmt.Errorf("can't encode pendingSuggestion#e7e82e12 as nil")
}
b.PutString(p.Suggestion)
if err := p.Title.Encode(b); err != nil {
return fmt.Errorf("unable to encode pendingSuggestion#e7e82e12: field title: %w", err)
}
if err := p.Description.Encode(b); err != nil {
return fmt.Errorf("unable to encode pendingSuggestion#e7e82e12: field description: %w", err)
}
b.PutString(p.URL)
return nil
}
// Decode implements bin.Decoder.
func (p *PendingSuggestion) Decode(b *bin.Buffer) error {
if p == nil {
return fmt.Errorf("can't decode pendingSuggestion#e7e82e12 to nil")
}
if err := b.ConsumeID(PendingSuggestionTypeID); err != nil {
return fmt.Errorf("unable to decode pendingSuggestion#e7e82e12: %w", err)
}
return p.DecodeBare(b)
}
// DecodeBare implements bin.BareDecoder.
func (p *PendingSuggestion) DecodeBare(b *bin.Buffer) error {
if p == nil {
return fmt.Errorf("can't decode pendingSuggestion#e7e82e12 to nil")
}
{
value, err := b.String()
if err != nil {
return fmt.Errorf("unable to decode pendingSuggestion#e7e82e12: field suggestion: %w", err)
}
p.Suggestion = value
}
{
if err := p.Title.Decode(b); err != nil {
return fmt.Errorf("unable to decode pendingSuggestion#e7e82e12: field title: %w", err)
}
}
{
if err := p.Description.Decode(b); err != nil {
return fmt.Errorf("unable to decode pendingSuggestion#e7e82e12: field description: %w", err)
}
}
{
value, err := b.String()
if err != nil {
return fmt.Errorf("unable to decode pendingSuggestion#e7e82e12: field url: %w", err)
}
p.URL = value
}
return nil
}
// GetSuggestion returns value of Suggestion field.
func (p *PendingSuggestion) GetSuggestion() (value string) {
if p == nil {
return
}
return p.Suggestion
}
// GetTitle returns value of Title field.
func (p *PendingSuggestion) GetTitle() (value TextWithEntities) {
if p == nil {
return
}
return p.Title
}
// GetDescription returns value of Description field.
func (p *PendingSuggestion) GetDescription() (value TextWithEntities) {
if p == nil {
return
}
return p.Description
}
// GetURL returns value of URL field.
func (p *PendingSuggestion) GetURL() (value string) {
if p == nil {
return
}
return p.URL
}