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,341 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// PaidReactor represents TL type `paidReactor#9d379008`.
|
||||
type PaidReactor struct {
|
||||
// Identifier of the user or chat that added the reactions; may be null for anonymous
|
||||
// reactors that aren't the current user
|
||||
SenderID MessageSenderClass
|
||||
// Number of Telegram Stars added
|
||||
StarCount int32
|
||||
// True, if the reactor is one of the most active reactors; may be false if the reactor
|
||||
// is the current user
|
||||
IsTop bool
|
||||
// True, if the paid reaction was added by the current user
|
||||
IsMe bool
|
||||
// True, if the reactor is anonymous
|
||||
IsAnonymous bool
|
||||
}
|
||||
|
||||
// PaidReactorTypeID is TL type id of PaidReactor.
|
||||
const PaidReactorTypeID = 0x9d379008
|
||||
|
||||
// Ensuring interfaces in compile-time for PaidReactor.
|
||||
var (
|
||||
_ bin.Encoder = &PaidReactor{}
|
||||
_ bin.Decoder = &PaidReactor{}
|
||||
_ bin.BareEncoder = &PaidReactor{}
|
||||
_ bin.BareDecoder = &PaidReactor{}
|
||||
)
|
||||
|
||||
func (p *PaidReactor) Zero() bool {
|
||||
if p == nil {
|
||||
return true
|
||||
}
|
||||
if !(p.SenderID == nil) {
|
||||
return false
|
||||
}
|
||||
if !(p.StarCount == 0) {
|
||||
return false
|
||||
}
|
||||
if !(p.IsTop == false) {
|
||||
return false
|
||||
}
|
||||
if !(p.IsMe == false) {
|
||||
return false
|
||||
}
|
||||
if !(p.IsAnonymous == false) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (p *PaidReactor) String() string {
|
||||
if p == nil {
|
||||
return "PaidReactor(nil)"
|
||||
}
|
||||
type Alias PaidReactor
|
||||
return fmt.Sprintf("PaidReactor%+v", Alias(*p))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*PaidReactor) TypeID() uint32 {
|
||||
return PaidReactorTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*PaidReactor) TypeName() string {
|
||||
return "paidReactor"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (p *PaidReactor) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "paidReactor",
|
||||
ID: PaidReactorTypeID,
|
||||
}
|
||||
if p == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "SenderID",
|
||||
SchemaName: "sender_id",
|
||||
},
|
||||
{
|
||||
Name: "StarCount",
|
||||
SchemaName: "star_count",
|
||||
},
|
||||
{
|
||||
Name: "IsTop",
|
||||
SchemaName: "is_top",
|
||||
},
|
||||
{
|
||||
Name: "IsMe",
|
||||
SchemaName: "is_me",
|
||||
},
|
||||
{
|
||||
Name: "IsAnonymous",
|
||||
SchemaName: "is_anonymous",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (p *PaidReactor) Encode(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't encode paidReactor#9d379008 as nil")
|
||||
}
|
||||
b.PutID(PaidReactorTypeID)
|
||||
return p.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (p *PaidReactor) EncodeBare(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't encode paidReactor#9d379008 as nil")
|
||||
}
|
||||
if p.SenderID == nil {
|
||||
return fmt.Errorf("unable to encode paidReactor#9d379008: field sender_id is nil")
|
||||
}
|
||||
if err := p.SenderID.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode paidReactor#9d379008: field sender_id: %w", err)
|
||||
}
|
||||
b.PutInt32(p.StarCount)
|
||||
b.PutBool(p.IsTop)
|
||||
b.PutBool(p.IsMe)
|
||||
b.PutBool(p.IsAnonymous)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (p *PaidReactor) Decode(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't decode paidReactor#9d379008 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(PaidReactorTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode paidReactor#9d379008: %w", err)
|
||||
}
|
||||
return p.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (p *PaidReactor) DecodeBare(b *bin.Buffer) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't decode paidReactor#9d379008 to nil")
|
||||
}
|
||||
{
|
||||
value, err := DecodeMessageSender(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode paidReactor#9d379008: field sender_id: %w", err)
|
||||
}
|
||||
p.SenderID = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int32()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode paidReactor#9d379008: field star_count: %w", err)
|
||||
}
|
||||
p.StarCount = value
|
||||
}
|
||||
{
|
||||
value, err := b.Bool()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode paidReactor#9d379008: field is_top: %w", err)
|
||||
}
|
||||
p.IsTop = value
|
||||
}
|
||||
{
|
||||
value, err := b.Bool()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode paidReactor#9d379008: field is_me: %w", err)
|
||||
}
|
||||
p.IsMe = value
|
||||
}
|
||||
{
|
||||
value, err := b.Bool()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode paidReactor#9d379008: field is_anonymous: %w", err)
|
||||
}
|
||||
p.IsAnonymous = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
||||
func (p *PaidReactor) EncodeTDLibJSON(b tdjson.Encoder) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't encode paidReactor#9d379008 as nil")
|
||||
}
|
||||
b.ObjStart()
|
||||
b.PutID("paidReactor")
|
||||
b.Comma()
|
||||
b.FieldStart("sender_id")
|
||||
if p.SenderID == nil {
|
||||
return fmt.Errorf("unable to encode paidReactor#9d379008: field sender_id is nil")
|
||||
}
|
||||
if err := p.SenderID.EncodeTDLibJSON(b); err != nil {
|
||||
return fmt.Errorf("unable to encode paidReactor#9d379008: field sender_id: %w", err)
|
||||
}
|
||||
b.Comma()
|
||||
b.FieldStart("star_count")
|
||||
b.PutInt32(p.StarCount)
|
||||
b.Comma()
|
||||
b.FieldStart("is_top")
|
||||
b.PutBool(p.IsTop)
|
||||
b.Comma()
|
||||
b.FieldStart("is_me")
|
||||
b.PutBool(p.IsMe)
|
||||
b.Comma()
|
||||
b.FieldStart("is_anonymous")
|
||||
b.PutBool(p.IsAnonymous)
|
||||
b.Comma()
|
||||
b.StripComma()
|
||||
b.ObjEnd()
|
||||
return nil
|
||||
}
|
||||
|
||||
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
||||
func (p *PaidReactor) DecodeTDLibJSON(b tdjson.Decoder) error {
|
||||
if p == nil {
|
||||
return fmt.Errorf("can't decode paidReactor#9d379008 to nil")
|
||||
}
|
||||
|
||||
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
||||
switch string(key) {
|
||||
case tdjson.TypeField:
|
||||
if err := b.ConsumeID("paidReactor"); err != nil {
|
||||
return fmt.Errorf("unable to decode paidReactor#9d379008: %w", err)
|
||||
}
|
||||
case "sender_id":
|
||||
value, err := DecodeTDLibJSONMessageSender(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode paidReactor#9d379008: field sender_id: %w", err)
|
||||
}
|
||||
p.SenderID = value
|
||||
case "star_count":
|
||||
value, err := b.Int32()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode paidReactor#9d379008: field star_count: %w", err)
|
||||
}
|
||||
p.StarCount = value
|
||||
case "is_top":
|
||||
value, err := b.Bool()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode paidReactor#9d379008: field is_top: %w", err)
|
||||
}
|
||||
p.IsTop = value
|
||||
case "is_me":
|
||||
value, err := b.Bool()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode paidReactor#9d379008: field is_me: %w", err)
|
||||
}
|
||||
p.IsMe = value
|
||||
case "is_anonymous":
|
||||
value, err := b.Bool()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode paidReactor#9d379008: field is_anonymous: %w", err)
|
||||
}
|
||||
p.IsAnonymous = value
|
||||
default:
|
||||
return b.Skip()
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
// GetSenderID returns value of SenderID field.
|
||||
func (p *PaidReactor) GetSenderID() (value MessageSenderClass) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
return p.SenderID
|
||||
}
|
||||
|
||||
// GetStarCount returns value of StarCount field.
|
||||
func (p *PaidReactor) GetStarCount() (value int32) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
return p.StarCount
|
||||
}
|
||||
|
||||
// GetIsTop returns value of IsTop field.
|
||||
func (p *PaidReactor) GetIsTop() (value bool) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
return p.IsTop
|
||||
}
|
||||
|
||||
// GetIsMe returns value of IsMe field.
|
||||
func (p *PaidReactor) GetIsMe() (value bool) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
return p.IsMe
|
||||
}
|
||||
|
||||
// GetIsAnonymous returns value of IsAnonymous field.
|
||||
func (p *PaidReactor) GetIsAnonymous() (value bool) {
|
||||
if p == nil {
|
||||
return
|
||||
}
|
||||
return p.IsAnonymous
|
||||
}
|
||||
Reference in New Issue
Block a user