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,225 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// InputBusinessGreetingMessage represents TL type `inputBusinessGreetingMessage#194cb3b`.
|
||||
// Describes a Telegram Business greeting¹, automatically sent to new users writing to
|
||||
// us in private for the first time, or after a certain inactivity period.
|
||||
//
|
||||
// Links:
|
||||
// 1. https://core.telegram.org/api/business#greeting-messages
|
||||
//
|
||||
// See https://core.telegram.org/constructor/inputBusinessGreetingMessage for reference.
|
||||
type InputBusinessGreetingMessage struct {
|
||||
// ID of a quick reply shorcut, containing the greeting messages to send, see here » for
|
||||
// more info¹.
|
||||
//
|
||||
// Links:
|
||||
// 1) https://core.telegram.org/api/business#quick-reply-shortcuts
|
||||
ShortcutID int
|
||||
// Allowed recipients for the greeting messages.
|
||||
Recipients InputBusinessRecipients
|
||||
// The number of days after which a private chat will be considered as inactive;
|
||||
// currently, must be one of 7, 14, 21, or 28.
|
||||
NoActivityDays int
|
||||
}
|
||||
|
||||
// InputBusinessGreetingMessageTypeID is TL type id of InputBusinessGreetingMessage.
|
||||
const InputBusinessGreetingMessageTypeID = 0x194cb3b
|
||||
|
||||
// Ensuring interfaces in compile-time for InputBusinessGreetingMessage.
|
||||
var (
|
||||
_ bin.Encoder = &InputBusinessGreetingMessage{}
|
||||
_ bin.Decoder = &InputBusinessGreetingMessage{}
|
||||
_ bin.BareEncoder = &InputBusinessGreetingMessage{}
|
||||
_ bin.BareDecoder = &InputBusinessGreetingMessage{}
|
||||
)
|
||||
|
||||
func (i *InputBusinessGreetingMessage) Zero() bool {
|
||||
if i == nil {
|
||||
return true
|
||||
}
|
||||
if !(i.ShortcutID == 0) {
|
||||
return false
|
||||
}
|
||||
if !(i.Recipients.Zero()) {
|
||||
return false
|
||||
}
|
||||
if !(i.NoActivityDays == 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (i *InputBusinessGreetingMessage) String() string {
|
||||
if i == nil {
|
||||
return "InputBusinessGreetingMessage(nil)"
|
||||
}
|
||||
type Alias InputBusinessGreetingMessage
|
||||
return fmt.Sprintf("InputBusinessGreetingMessage%+v", Alias(*i))
|
||||
}
|
||||
|
||||
// FillFrom fills InputBusinessGreetingMessage from given interface.
|
||||
func (i *InputBusinessGreetingMessage) FillFrom(from interface {
|
||||
GetShortcutID() (value int)
|
||||
GetRecipients() (value InputBusinessRecipients)
|
||||
GetNoActivityDays() (value int)
|
||||
}) {
|
||||
i.ShortcutID = from.GetShortcutID()
|
||||
i.Recipients = from.GetRecipients()
|
||||
i.NoActivityDays = from.GetNoActivityDays()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*InputBusinessGreetingMessage) TypeID() uint32 {
|
||||
return InputBusinessGreetingMessageTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*InputBusinessGreetingMessage) TypeName() string {
|
||||
return "inputBusinessGreetingMessage"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (i *InputBusinessGreetingMessage) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "inputBusinessGreetingMessage",
|
||||
ID: InputBusinessGreetingMessageTypeID,
|
||||
}
|
||||
if i == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "ShortcutID",
|
||||
SchemaName: "shortcut_id",
|
||||
},
|
||||
{
|
||||
Name: "Recipients",
|
||||
SchemaName: "recipients",
|
||||
},
|
||||
{
|
||||
Name: "NoActivityDays",
|
||||
SchemaName: "no_activity_days",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (i *InputBusinessGreetingMessage) Encode(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't encode inputBusinessGreetingMessage#194cb3b as nil")
|
||||
}
|
||||
b.PutID(InputBusinessGreetingMessageTypeID)
|
||||
return i.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (i *InputBusinessGreetingMessage) EncodeBare(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't encode inputBusinessGreetingMessage#194cb3b as nil")
|
||||
}
|
||||
b.PutInt(i.ShortcutID)
|
||||
if err := i.Recipients.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode inputBusinessGreetingMessage#194cb3b: field recipients: %w", err)
|
||||
}
|
||||
b.PutInt(i.NoActivityDays)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (i *InputBusinessGreetingMessage) Decode(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't decode inputBusinessGreetingMessage#194cb3b to nil")
|
||||
}
|
||||
if err := b.ConsumeID(InputBusinessGreetingMessageTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode inputBusinessGreetingMessage#194cb3b: %w", err)
|
||||
}
|
||||
return i.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (i *InputBusinessGreetingMessage) DecodeBare(b *bin.Buffer) error {
|
||||
if i == nil {
|
||||
return fmt.Errorf("can't decode inputBusinessGreetingMessage#194cb3b to nil")
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode inputBusinessGreetingMessage#194cb3b: field shortcut_id: %w", err)
|
||||
}
|
||||
i.ShortcutID = value
|
||||
}
|
||||
{
|
||||
if err := i.Recipients.Decode(b); err != nil {
|
||||
return fmt.Errorf("unable to decode inputBusinessGreetingMessage#194cb3b: field recipients: %w", err)
|
||||
}
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode inputBusinessGreetingMessage#194cb3b: field no_activity_days: %w", err)
|
||||
}
|
||||
i.NoActivityDays = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetShortcutID returns value of ShortcutID field.
|
||||
func (i *InputBusinessGreetingMessage) GetShortcutID() (value int) {
|
||||
if i == nil {
|
||||
return
|
||||
}
|
||||
return i.ShortcutID
|
||||
}
|
||||
|
||||
// GetRecipients returns value of Recipients field.
|
||||
func (i *InputBusinessGreetingMessage) GetRecipients() (value InputBusinessRecipients) {
|
||||
if i == nil {
|
||||
return
|
||||
}
|
||||
return i.Recipients
|
||||
}
|
||||
|
||||
// GetNoActivityDays returns value of NoActivityDays field.
|
||||
func (i *InputBusinessGreetingMessage) GetNoActivityDays() (value int) {
|
||||
if i == nil {
|
||||
return
|
||||
}
|
||||
return i.NoActivityDays
|
||||
}
|
||||
Reference in New Issue
Block a user