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
@@ -0,0 +1,296 @@
// 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{}
)
// VerificationStatus represents TL type `verificationStatus#3ae6a18c`.
type VerificationStatus struct {
// True, if the chat or the user is verified by Telegram
IsVerified bool
// True, if the chat or the user is marked as scam by Telegram
IsScam bool
// True, if the chat or the user is marked as fake by Telegram
IsFake bool
// Identifier of the custom emoji to be shown as verification sign provided by a bot for
// the user; 0 if none
BotVerificationIconCustomEmojiID int64
}
// VerificationStatusTypeID is TL type id of VerificationStatus.
const VerificationStatusTypeID = 0x3ae6a18c
// Ensuring interfaces in compile-time for VerificationStatus.
var (
_ bin.Encoder = &VerificationStatus{}
_ bin.Decoder = &VerificationStatus{}
_ bin.BareEncoder = &VerificationStatus{}
_ bin.BareDecoder = &VerificationStatus{}
)
func (v *VerificationStatus) Zero() bool {
if v == nil {
return true
}
if !(v.IsVerified == false) {
return false
}
if !(v.IsScam == false) {
return false
}
if !(v.IsFake == false) {
return false
}
if !(v.BotVerificationIconCustomEmojiID == 0) {
return false
}
return true
}
// String implements fmt.Stringer.
func (v *VerificationStatus) String() string {
if v == nil {
return "VerificationStatus(nil)"
}
type Alias VerificationStatus
return fmt.Sprintf("VerificationStatus%+v", Alias(*v))
}
// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*VerificationStatus) TypeID() uint32 {
return VerificationStatusTypeID
}
// TypeName returns name of type in TL schema.
func (*VerificationStatus) TypeName() string {
return "verificationStatus"
}
// TypeInfo returns info about TL type.
func (v *VerificationStatus) TypeInfo() tdp.Type {
typ := tdp.Type{
Name: "verificationStatus",
ID: VerificationStatusTypeID,
}
if v == nil {
typ.Null = true
return typ
}
typ.Fields = []tdp.Field{
{
Name: "IsVerified",
SchemaName: "is_verified",
},
{
Name: "IsScam",
SchemaName: "is_scam",
},
{
Name: "IsFake",
SchemaName: "is_fake",
},
{
Name: "BotVerificationIconCustomEmojiID",
SchemaName: "bot_verification_icon_custom_emoji_id",
},
}
return typ
}
// Encode implements bin.Encoder.
func (v *VerificationStatus) Encode(b *bin.Buffer) error {
if v == nil {
return fmt.Errorf("can't encode verificationStatus#3ae6a18c as nil")
}
b.PutID(VerificationStatusTypeID)
return v.EncodeBare(b)
}
// EncodeBare implements bin.BareEncoder.
func (v *VerificationStatus) EncodeBare(b *bin.Buffer) error {
if v == nil {
return fmt.Errorf("can't encode verificationStatus#3ae6a18c as nil")
}
b.PutBool(v.IsVerified)
b.PutBool(v.IsScam)
b.PutBool(v.IsFake)
b.PutLong(v.BotVerificationIconCustomEmojiID)
return nil
}
// Decode implements bin.Decoder.
func (v *VerificationStatus) Decode(b *bin.Buffer) error {
if v == nil {
return fmt.Errorf("can't decode verificationStatus#3ae6a18c to nil")
}
if err := b.ConsumeID(VerificationStatusTypeID); err != nil {
return fmt.Errorf("unable to decode verificationStatus#3ae6a18c: %w", err)
}
return v.DecodeBare(b)
}
// DecodeBare implements bin.BareDecoder.
func (v *VerificationStatus) DecodeBare(b *bin.Buffer) error {
if v == nil {
return fmt.Errorf("can't decode verificationStatus#3ae6a18c to nil")
}
{
value, err := b.Bool()
if err != nil {
return fmt.Errorf("unable to decode verificationStatus#3ae6a18c: field is_verified: %w", err)
}
v.IsVerified = value
}
{
value, err := b.Bool()
if err != nil {
return fmt.Errorf("unable to decode verificationStatus#3ae6a18c: field is_scam: %w", err)
}
v.IsScam = value
}
{
value, err := b.Bool()
if err != nil {
return fmt.Errorf("unable to decode verificationStatus#3ae6a18c: field is_fake: %w", err)
}
v.IsFake = value
}
{
value, err := b.Long()
if err != nil {
return fmt.Errorf("unable to decode verificationStatus#3ae6a18c: field bot_verification_icon_custom_emoji_id: %w", err)
}
v.BotVerificationIconCustomEmojiID = value
}
return nil
}
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
func (v *VerificationStatus) EncodeTDLibJSON(b tdjson.Encoder) error {
if v == nil {
return fmt.Errorf("can't encode verificationStatus#3ae6a18c as nil")
}
b.ObjStart()
b.PutID("verificationStatus")
b.Comma()
b.FieldStart("is_verified")
b.PutBool(v.IsVerified)
b.Comma()
b.FieldStart("is_scam")
b.PutBool(v.IsScam)
b.Comma()
b.FieldStart("is_fake")
b.PutBool(v.IsFake)
b.Comma()
b.FieldStart("bot_verification_icon_custom_emoji_id")
b.PutLong(v.BotVerificationIconCustomEmojiID)
b.Comma()
b.StripComma()
b.ObjEnd()
return nil
}
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
func (v *VerificationStatus) DecodeTDLibJSON(b tdjson.Decoder) error {
if v == nil {
return fmt.Errorf("can't decode verificationStatus#3ae6a18c to nil")
}
return b.Obj(func(b tdjson.Decoder, key []byte) error {
switch string(key) {
case tdjson.TypeField:
if err := b.ConsumeID("verificationStatus"); err != nil {
return fmt.Errorf("unable to decode verificationStatus#3ae6a18c: %w", err)
}
case "is_verified":
value, err := b.Bool()
if err != nil {
return fmt.Errorf("unable to decode verificationStatus#3ae6a18c: field is_verified: %w", err)
}
v.IsVerified = value
case "is_scam":
value, err := b.Bool()
if err != nil {
return fmt.Errorf("unable to decode verificationStatus#3ae6a18c: field is_scam: %w", err)
}
v.IsScam = value
case "is_fake":
value, err := b.Bool()
if err != nil {
return fmt.Errorf("unable to decode verificationStatus#3ae6a18c: field is_fake: %w", err)
}
v.IsFake = value
case "bot_verification_icon_custom_emoji_id":
value, err := b.Long()
if err != nil {
return fmt.Errorf("unable to decode verificationStatus#3ae6a18c: field bot_verification_icon_custom_emoji_id: %w", err)
}
v.BotVerificationIconCustomEmojiID = value
default:
return b.Skip()
}
return nil
})
}
// GetIsVerified returns value of IsVerified field.
func (v *VerificationStatus) GetIsVerified() (value bool) {
if v == nil {
return
}
return v.IsVerified
}
// GetIsScam returns value of IsScam field.
func (v *VerificationStatus) GetIsScam() (value bool) {
if v == nil {
return
}
return v.IsScam
}
// GetIsFake returns value of IsFake field.
func (v *VerificationStatus) GetIsFake() (value bool) {
if v == nil {
return
}
return v.IsFake
}
// GetBotVerificationIconCustomEmojiID returns value of BotVerificationIconCustomEmojiID field.
func (v *VerificationStatus) GetBotVerificationIconCustomEmojiID() (value int64) {
if v == nil {
return
}
return v.BotVerificationIconCustomEmojiID
}