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
+227
View File
@@ -0,0 +1,227 @@
// Code generated by gotdgen, DO NOT EDIT.
package tdapi
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{}
)
// EmojiKeyword represents TL type `emojiKeyword#821912df`.
type EmojiKeyword struct {
// The emoji
Emoji string
// The keyword
Keyword string
}
// EmojiKeywordTypeID is TL type id of EmojiKeyword.
const EmojiKeywordTypeID = 0x821912df
// Ensuring interfaces in compile-time for EmojiKeyword.
var (
_ bin.Encoder = &EmojiKeyword{}
_ bin.Decoder = &EmojiKeyword{}
_ bin.BareEncoder = &EmojiKeyword{}
_ bin.BareDecoder = &EmojiKeyword{}
)
func (e *EmojiKeyword) Zero() bool {
if e == nil {
return true
}
if !(e.Emoji == "") {
return false
}
if !(e.Keyword == "") {
return false
}
return true
}
// String implements fmt.Stringer.
func (e *EmojiKeyword) String() string {
if e == nil {
return "EmojiKeyword(nil)"
}
type Alias EmojiKeyword
return fmt.Sprintf("EmojiKeyword%+v", Alias(*e))
}
// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*EmojiKeyword) TypeID() uint32 {
return EmojiKeywordTypeID
}
// TypeName returns name of type in TL schema.
func (*EmojiKeyword) TypeName() string {
return "emojiKeyword"
}
// TypeInfo returns info about TL type.
func (e *EmojiKeyword) TypeInfo() tdp.Type {
typ := tdp.Type{
Name: "emojiKeyword",
ID: EmojiKeywordTypeID,
}
if e == nil {
typ.Null = true
return typ
}
typ.Fields = []tdp.Field{
{
Name: "Emoji",
SchemaName: "emoji",
},
{
Name: "Keyword",
SchemaName: "keyword",
},
}
return typ
}
// Encode implements bin.Encoder.
func (e *EmojiKeyword) Encode(b *bin.Buffer) error {
if e == nil {
return fmt.Errorf("can't encode emojiKeyword#821912df as nil")
}
b.PutID(EmojiKeywordTypeID)
return e.EncodeBare(b)
}
// EncodeBare implements bin.BareEncoder.
func (e *EmojiKeyword) EncodeBare(b *bin.Buffer) error {
if e == nil {
return fmt.Errorf("can't encode emojiKeyword#821912df as nil")
}
b.PutString(e.Emoji)
b.PutString(e.Keyword)
return nil
}
// Decode implements bin.Decoder.
func (e *EmojiKeyword) Decode(b *bin.Buffer) error {
if e == nil {
return fmt.Errorf("can't decode emojiKeyword#821912df to nil")
}
if err := b.ConsumeID(EmojiKeywordTypeID); err != nil {
return fmt.Errorf("unable to decode emojiKeyword#821912df: %w", err)
}
return e.DecodeBare(b)
}
// DecodeBare implements bin.BareDecoder.
func (e *EmojiKeyword) DecodeBare(b *bin.Buffer) error {
if e == nil {
return fmt.Errorf("can't decode emojiKeyword#821912df to nil")
}
{
value, err := b.String()
if err != nil {
return fmt.Errorf("unable to decode emojiKeyword#821912df: field emoji: %w", err)
}
e.Emoji = value
}
{
value, err := b.String()
if err != nil {
return fmt.Errorf("unable to decode emojiKeyword#821912df: field keyword: %w", err)
}
e.Keyword = value
}
return nil
}
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (e *EmojiKeyword) EncodeTDLibJSON(b tdjson.Encoder) error {
if e == nil {
return fmt.Errorf("can't encode emojiKeyword#821912df as nil")
}
b.ObjStart()
b.PutID("emojiKeyword")
b.Comma()
b.FieldStart("emoji")
b.PutString(e.Emoji)
b.Comma()
b.FieldStart("keyword")
b.PutString(e.Keyword)
b.Comma()
b.StripComma()
b.ObjEnd()
return nil
}
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (e *EmojiKeyword) DecodeTDLibJSON(b tdjson.Decoder) error {
if e == nil {
return fmt.Errorf("can't decode emojiKeyword#821912df to nil")
}
return b.Obj(func(b tdjson.Decoder, key []byte) error {
switch string(key) {
case tdjson.TypeField:
if err := b.ConsumeID("emojiKeyword"); err != nil {
return fmt.Errorf("unable to decode emojiKeyword#821912df: %w", err)
}
case "emoji":
value, err := b.String()
if err != nil {
return fmt.Errorf("unable to decode emojiKeyword#821912df: field emoji: %w", err)
}
e.Emoji = value
case "keyword":
value, err := b.String()
if err != nil {
return fmt.Errorf("unable to decode emojiKeyword#821912df: field keyword: %w", err)
}
e.Keyword = value
default:
return b.Skip()
}
return nil
})
}
// GetEmoji returns value of Emoji field.
func (e *EmojiKeyword) GetEmoji() (value string) {
if e == nil {
return
}
return e.Emoji
}
// GetKeyword returns value of Keyword field.
func (e *EmojiKeyword) GetKeyword() (value string) {
if e == nil {
return
}
return e.Keyword
}