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,261 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// BusinessConnectedBot represents TL type `businessConnectedBot#93ca9953`.
|
||||
type BusinessConnectedBot struct {
|
||||
// User identifier of the bot
|
||||
BotUserID int64
|
||||
// Private chats that will be accessible to the bot
|
||||
Recipients BusinessRecipients
|
||||
// Rights of the bot
|
||||
Rights BusinessBotRights
|
||||
}
|
||||
|
||||
// BusinessConnectedBotTypeID is TL type id of BusinessConnectedBot.
|
||||
const BusinessConnectedBotTypeID = 0x93ca9953
|
||||
|
||||
// Ensuring interfaces in compile-time for BusinessConnectedBot.
|
||||
var (
|
||||
_ bin.Encoder = &BusinessConnectedBot{}
|
||||
_ bin.Decoder = &BusinessConnectedBot{}
|
||||
_ bin.BareEncoder = &BusinessConnectedBot{}
|
||||
_ bin.BareDecoder = &BusinessConnectedBot{}
|
||||
)
|
||||
|
||||
func (b *BusinessConnectedBot) Zero() bool {
|
||||
if b == nil {
|
||||
return true
|
||||
}
|
||||
if !(b.BotUserID == 0) {
|
||||
return false
|
||||
}
|
||||
if !(b.Recipients.Zero()) {
|
||||
return false
|
||||
}
|
||||
if !(b.Rights.Zero()) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (b *BusinessConnectedBot) String() string {
|
||||
if b == nil {
|
||||
return "BusinessConnectedBot(nil)"
|
||||
}
|
||||
type Alias BusinessConnectedBot
|
||||
return fmt.Sprintf("BusinessConnectedBot%+v", Alias(*b))
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*BusinessConnectedBot) TypeID() uint32 {
|
||||
return BusinessConnectedBotTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*BusinessConnectedBot) TypeName() string {
|
||||
return "businessConnectedBot"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (b *BusinessConnectedBot) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "businessConnectedBot",
|
||||
ID: BusinessConnectedBotTypeID,
|
||||
}
|
||||
if b == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "BotUserID",
|
||||
SchemaName: "bot_user_id",
|
||||
},
|
||||
{
|
||||
Name: "Recipients",
|
||||
SchemaName: "recipients",
|
||||
},
|
||||
{
|
||||
Name: "Rights",
|
||||
SchemaName: "rights",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (b *BusinessConnectedBot) Encode(buf *bin.Buffer) error {
|
||||
if b == nil {
|
||||
return fmt.Errorf("can't encode businessConnectedBot#93ca9953 as nil")
|
||||
}
|
||||
buf.PutID(BusinessConnectedBotTypeID)
|
||||
return b.EncodeBare(buf)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (b *BusinessConnectedBot) EncodeBare(buf *bin.Buffer) error {
|
||||
if b == nil {
|
||||
return fmt.Errorf("can't encode businessConnectedBot#93ca9953 as nil")
|
||||
}
|
||||
buf.PutInt53(b.BotUserID)
|
||||
if err := b.Recipients.Encode(buf); err != nil {
|
||||
return fmt.Errorf("unable to encode businessConnectedBot#93ca9953: field recipients: %w", err)
|
||||
}
|
||||
if err := b.Rights.Encode(buf); err != nil {
|
||||
return fmt.Errorf("unable to encode businessConnectedBot#93ca9953: field rights: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (b *BusinessConnectedBot) Decode(buf *bin.Buffer) error {
|
||||
if b == nil {
|
||||
return fmt.Errorf("can't decode businessConnectedBot#93ca9953 to nil")
|
||||
}
|
||||
if err := buf.ConsumeID(BusinessConnectedBotTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode businessConnectedBot#93ca9953: %w", err)
|
||||
}
|
||||
return b.DecodeBare(buf)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (b *BusinessConnectedBot) DecodeBare(buf *bin.Buffer) error {
|
||||
if b == nil {
|
||||
return fmt.Errorf("can't decode businessConnectedBot#93ca9953 to nil")
|
||||
}
|
||||
{
|
||||
value, err := buf.Int53()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode businessConnectedBot#93ca9953: field bot_user_id: %w", err)
|
||||
}
|
||||
b.BotUserID = value
|
||||
}
|
||||
{
|
||||
if err := b.Recipients.Decode(buf); err != nil {
|
||||
return fmt.Errorf("unable to decode businessConnectedBot#93ca9953: field recipients: %w", err)
|
||||
}
|
||||
}
|
||||
{
|
||||
if err := b.Rights.Decode(buf); err != nil {
|
||||
return fmt.Errorf("unable to decode businessConnectedBot#93ca9953: field rights: %w", err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
||||
func (b *BusinessConnectedBot) EncodeTDLibJSON(buf tdjson.Encoder) error {
|
||||
if b == nil {
|
||||
return fmt.Errorf("can't encode businessConnectedBot#93ca9953 as nil")
|
||||
}
|
||||
buf.ObjStart()
|
||||
buf.PutID("businessConnectedBot")
|
||||
buf.Comma()
|
||||
buf.FieldStart("bot_user_id")
|
||||
buf.PutInt53(b.BotUserID)
|
||||
buf.Comma()
|
||||
buf.FieldStart("recipients")
|
||||
if err := b.Recipients.EncodeTDLibJSON(buf); err != nil {
|
||||
return fmt.Errorf("unable to encode businessConnectedBot#93ca9953: field recipients: %w", err)
|
||||
}
|
||||
buf.Comma()
|
||||
buf.FieldStart("rights")
|
||||
if err := b.Rights.EncodeTDLibJSON(buf); err != nil {
|
||||
return fmt.Errorf("unable to encode businessConnectedBot#93ca9953: field rights: %w", err)
|
||||
}
|
||||
buf.Comma()
|
||||
buf.StripComma()
|
||||
buf.ObjEnd()
|
||||
return nil
|
||||
}
|
||||
|
||||
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
||||
func (b *BusinessConnectedBot) DecodeTDLibJSON(buf tdjson.Decoder) error {
|
||||
if b == nil {
|
||||
return fmt.Errorf("can't decode businessConnectedBot#93ca9953 to nil")
|
||||
}
|
||||
|
||||
return buf.Obj(func(buf tdjson.Decoder, key []byte) error {
|
||||
switch string(key) {
|
||||
case tdjson.TypeField:
|
||||
if err := buf.ConsumeID("businessConnectedBot"); err != nil {
|
||||
return fmt.Errorf("unable to decode businessConnectedBot#93ca9953: %w", err)
|
||||
}
|
||||
case "bot_user_id":
|
||||
value, err := buf.Int53()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode businessConnectedBot#93ca9953: field bot_user_id: %w", err)
|
||||
}
|
||||
b.BotUserID = value
|
||||
case "recipients":
|
||||
if err := b.Recipients.DecodeTDLibJSON(buf); err != nil {
|
||||
return fmt.Errorf("unable to decode businessConnectedBot#93ca9953: field recipients: %w", err)
|
||||
}
|
||||
case "rights":
|
||||
if err := b.Rights.DecodeTDLibJSON(buf); err != nil {
|
||||
return fmt.Errorf("unable to decode businessConnectedBot#93ca9953: field rights: %w", err)
|
||||
}
|
||||
default:
|
||||
return buf.Skip()
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
// GetBotUserID returns value of BotUserID field.
|
||||
func (b *BusinessConnectedBot) GetBotUserID() (value int64) {
|
||||
if b == nil {
|
||||
return
|
||||
}
|
||||
return b.BotUserID
|
||||
}
|
||||
|
||||
// GetRecipients returns value of Recipients field.
|
||||
func (b *BusinessConnectedBot) GetRecipients() (value BusinessRecipients) {
|
||||
if b == nil {
|
||||
return
|
||||
}
|
||||
return b.Recipients
|
||||
}
|
||||
|
||||
// GetRights returns value of Rights field.
|
||||
func (b *BusinessConnectedBot) GetRights() (value BusinessBotRights) {
|
||||
if b == nil {
|
||||
return
|
||||
}
|
||||
return b.Rights
|
||||
}
|
||||
Reference in New Issue
Block a user