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,244 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// ConnectedBot represents TL type `connectedBot#cd64636c`.
|
||||
// Contains info about a connected business bot »¹.
|
||||
//
|
||||
// Links:
|
||||
// 1. https://core.telegram.org/api/business#connected-bots
|
||||
//
|
||||
// See https://core.telegram.org/constructor/connectedBot for reference.
|
||||
type ConnectedBot struct {
|
||||
// Flags, see TL conditional fields¹
|
||||
//
|
||||
// Links:
|
||||
// 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
|
||||
Flags bin.Fields
|
||||
// ID of the connected bot
|
||||
BotID int64
|
||||
// Specifies the private chats that a connected business bot »¹ may receive messages
|
||||
// and interact with.
|
||||
//
|
||||
// Links:
|
||||
// 1) https://core.telegram.org/api/business#connected-bots
|
||||
Recipients BusinessBotRecipients
|
||||
// Rights field of ConnectedBot.
|
||||
Rights BusinessBotRights
|
||||
}
|
||||
|
||||
// ConnectedBotTypeID is TL type id of ConnectedBot.
|
||||
const ConnectedBotTypeID = 0xcd64636c
|
||||
|
||||
// Ensuring interfaces in compile-time for ConnectedBot.
|
||||
var (
|
||||
_ bin.Encoder = &ConnectedBot{}
|
||||
_ bin.Decoder = &ConnectedBot{}
|
||||
_ bin.BareEncoder = &ConnectedBot{}
|
||||
_ bin.BareDecoder = &ConnectedBot{}
|
||||
)
|
||||
|
||||
func (c *ConnectedBot) Zero() bool {
|
||||
if c == nil {
|
||||
return true
|
||||
}
|
||||
if !(c.Flags.Zero()) {
|
||||
return false
|
||||
}
|
||||
if !(c.BotID == 0) {
|
||||
return false
|
||||
}
|
||||
if !(c.Recipients.Zero()) {
|
||||
return false
|
||||
}
|
||||
if !(c.Rights.Zero()) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (c *ConnectedBot) String() string {
|
||||
if c == nil {
|
||||
return "ConnectedBot(nil)"
|
||||
}
|
||||
type Alias ConnectedBot
|
||||
return fmt.Sprintf("ConnectedBot%+v", Alias(*c))
|
||||
}
|
||||
|
||||
// FillFrom fills ConnectedBot from given interface.
|
||||
func (c *ConnectedBot) FillFrom(from interface {
|
||||
GetBotID() (value int64)
|
||||
GetRecipients() (value BusinessBotRecipients)
|
||||
GetRights() (value BusinessBotRights)
|
||||
}) {
|
||||
c.BotID = from.GetBotID()
|
||||
c.Recipients = from.GetRecipients()
|
||||
c.Rights = from.GetRights()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*ConnectedBot) TypeID() uint32 {
|
||||
return ConnectedBotTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*ConnectedBot) TypeName() string {
|
||||
return "connectedBot"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (c *ConnectedBot) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "connectedBot",
|
||||
ID: ConnectedBotTypeID,
|
||||
}
|
||||
if c == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "BotID",
|
||||
SchemaName: "bot_id",
|
||||
},
|
||||
{
|
||||
Name: "Recipients",
|
||||
SchemaName: "recipients",
|
||||
},
|
||||
{
|
||||
Name: "Rights",
|
||||
SchemaName: "rights",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// SetFlags sets flags for non-zero fields.
|
||||
func (c *ConnectedBot) SetFlags() {
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (c *ConnectedBot) Encode(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't encode connectedBot#cd64636c as nil")
|
||||
}
|
||||
b.PutID(ConnectedBotTypeID)
|
||||
return c.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (c *ConnectedBot) EncodeBare(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't encode connectedBot#cd64636c as nil")
|
||||
}
|
||||
c.SetFlags()
|
||||
if err := c.Flags.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode connectedBot#cd64636c: field flags: %w", err)
|
||||
}
|
||||
b.PutLong(c.BotID)
|
||||
if err := c.Recipients.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode connectedBot#cd64636c: field recipients: %w", err)
|
||||
}
|
||||
if err := c.Rights.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode connectedBot#cd64636c: field rights: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (c *ConnectedBot) Decode(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't decode connectedBot#cd64636c to nil")
|
||||
}
|
||||
if err := b.ConsumeID(ConnectedBotTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode connectedBot#cd64636c: %w", err)
|
||||
}
|
||||
return c.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (c *ConnectedBot) DecodeBare(b *bin.Buffer) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("can't decode connectedBot#cd64636c to nil")
|
||||
}
|
||||
{
|
||||
if err := c.Flags.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode connectedBot#cd64636c: field flags: %w", err)
|
||||
}
|
||||
}
|
||||
{
|
||||
value, err := b.Long()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode connectedBot#cd64636c: field bot_id: %w", err)
|
||||
}
|
||||
c.BotID = value
|
||||
}
|
||||
{
|
||||
if err := c.Recipients.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode connectedBot#cd64636c: field recipients: %w", err)
|
||||
}
|
||||
}
|
||||
{
|
||||
if err := c.Rights.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode connectedBot#cd64636c: field rights: %w", err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetBotID returns value of BotID field.
|
||||
func (c *ConnectedBot) GetBotID() (value int64) {
|
||||
if c == nil {
|
||||
return
|
||||
}
|
||||
return c.BotID
|
||||
}
|
||||
|
||||
// GetRecipients returns value of Recipients field.
|
||||
func (c *ConnectedBot) GetRecipients() (value BusinessBotRecipients) {
|
||||
if c == nil {
|
||||
return
|
||||
}
|
||||
return c.Recipients
|
||||
}
|
||||
|
||||
// GetRights returns value of Rights field.
|
||||
func (c *ConnectedBot) GetRights() (value BusinessBotRights) {
|
||||
if c == nil {
|
||||
return
|
||||
}
|
||||
return c.Rights
|
||||
}
|
||||
Reference in New Issue
Block a user