7a04f298d2
- 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
464 lines
12 KiB
Go
464 lines
12 KiB
Go
// 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{}
|
|
)
|
|
|
|
// QuickReplyMessage represents TL type `quickReplyMessage#bef92f03`.
|
|
type QuickReplyMessage struct {
|
|
// Unique message identifier among all quick replies
|
|
ID int64
|
|
// The sending state of the message; may be null if the message isn't being sent and
|
|
// didn't fail to be sent
|
|
SendingState MessageSendingStateClass
|
|
// True, if the message can be edited
|
|
CanBeEdited bool
|
|
// The identifier of the quick reply message to which the message replies; 0 if none
|
|
ReplyToMessageID int64
|
|
// If non-zero, the user identifier of the bot through which this message was sent
|
|
ViaBotUserID int64
|
|
// Unique identifier of an album this message belongs to; 0 if none. Only audios,
|
|
// documents, photos and videos can be grouped together in albums
|
|
MediaAlbumID int64
|
|
// Content of the message
|
|
Content MessageContentClass
|
|
// Inline keyboard reply markup for the message; may be null if none
|
|
ReplyMarkup ReplyMarkupClass
|
|
}
|
|
|
|
// QuickReplyMessageTypeID is TL type id of QuickReplyMessage.
|
|
const QuickReplyMessageTypeID = 0xbef92f03
|
|
|
|
// Ensuring interfaces in compile-time for QuickReplyMessage.
|
|
var (
|
|
_ bin.Encoder = &QuickReplyMessage{}
|
|
_ bin.Decoder = &QuickReplyMessage{}
|
|
_ bin.BareEncoder = &QuickReplyMessage{}
|
|
_ bin.BareDecoder = &QuickReplyMessage{}
|
|
)
|
|
|
|
func (q *QuickReplyMessage) Zero() bool {
|
|
if q == nil {
|
|
return true
|
|
}
|
|
if !(q.ID == 0) {
|
|
return false
|
|
}
|
|
if !(q.SendingState == nil) {
|
|
return false
|
|
}
|
|
if !(q.CanBeEdited == false) {
|
|
return false
|
|
}
|
|
if !(q.ReplyToMessageID == 0) {
|
|
return false
|
|
}
|
|
if !(q.ViaBotUserID == 0) {
|
|
return false
|
|
}
|
|
if !(q.MediaAlbumID == 0) {
|
|
return false
|
|
}
|
|
if !(q.Content == nil) {
|
|
return false
|
|
}
|
|
if !(q.ReplyMarkup == nil) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (q *QuickReplyMessage) String() string {
|
|
if q == nil {
|
|
return "QuickReplyMessage(nil)"
|
|
}
|
|
type Alias QuickReplyMessage
|
|
return fmt.Sprintf("QuickReplyMessage%+v", Alias(*q))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*QuickReplyMessage) TypeID() uint32 {
|
|
return QuickReplyMessageTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*QuickReplyMessage) TypeName() string {
|
|
return "quickReplyMessage"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (q *QuickReplyMessage) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "quickReplyMessage",
|
|
ID: QuickReplyMessageTypeID,
|
|
}
|
|
if q == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "ID",
|
|
SchemaName: "id",
|
|
},
|
|
{
|
|
Name: "SendingState",
|
|
SchemaName: "sending_state",
|
|
},
|
|
{
|
|
Name: "CanBeEdited",
|
|
SchemaName: "can_be_edited",
|
|
},
|
|
{
|
|
Name: "ReplyToMessageID",
|
|
SchemaName: "reply_to_message_id",
|
|
},
|
|
{
|
|
Name: "ViaBotUserID",
|
|
SchemaName: "via_bot_user_id",
|
|
},
|
|
{
|
|
Name: "MediaAlbumID",
|
|
SchemaName: "media_album_id",
|
|
},
|
|
{
|
|
Name: "Content",
|
|
SchemaName: "content",
|
|
},
|
|
{
|
|
Name: "ReplyMarkup",
|
|
SchemaName: "reply_markup",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (q *QuickReplyMessage) Encode(b *bin.Buffer) error {
|
|
if q == nil {
|
|
return fmt.Errorf("can't encode quickReplyMessage#bef92f03 as nil")
|
|
}
|
|
b.PutID(QuickReplyMessageTypeID)
|
|
return q.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (q *QuickReplyMessage) EncodeBare(b *bin.Buffer) error {
|
|
if q == nil {
|
|
return fmt.Errorf("can't encode quickReplyMessage#bef92f03 as nil")
|
|
}
|
|
b.PutInt53(q.ID)
|
|
if q.SendingState == nil {
|
|
return fmt.Errorf("unable to encode quickReplyMessage#bef92f03: field sending_state is nil")
|
|
}
|
|
if err := q.SendingState.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode quickReplyMessage#bef92f03: field sending_state: %w", err)
|
|
}
|
|
b.PutBool(q.CanBeEdited)
|
|
b.PutInt53(q.ReplyToMessageID)
|
|
b.PutInt53(q.ViaBotUserID)
|
|
b.PutLong(q.MediaAlbumID)
|
|
if q.Content == nil {
|
|
return fmt.Errorf("unable to encode quickReplyMessage#bef92f03: field content is nil")
|
|
}
|
|
if err := q.Content.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode quickReplyMessage#bef92f03: field content: %w", err)
|
|
}
|
|
if q.ReplyMarkup == nil {
|
|
return fmt.Errorf("unable to encode quickReplyMessage#bef92f03: field reply_markup is nil")
|
|
}
|
|
if err := q.ReplyMarkup.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode quickReplyMessage#bef92f03: field reply_markup: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (q *QuickReplyMessage) Decode(b *bin.Buffer) error {
|
|
if q == nil {
|
|
return fmt.Errorf("can't decode quickReplyMessage#bef92f03 to nil")
|
|
}
|
|
if err := b.ConsumeID(QuickReplyMessageTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode quickReplyMessage#bef92f03: %w", err)
|
|
}
|
|
return q.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (q *QuickReplyMessage) DecodeBare(b *bin.Buffer) error {
|
|
if q == nil {
|
|
return fmt.Errorf("can't decode quickReplyMessage#bef92f03 to nil")
|
|
}
|
|
{
|
|
value, err := b.Int53()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode quickReplyMessage#bef92f03: field id: %w", err)
|
|
}
|
|
q.ID = value
|
|
}
|
|
{
|
|
value, err := DecodeMessageSendingState(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode quickReplyMessage#bef92f03: field sending_state: %w", err)
|
|
}
|
|
q.SendingState = value
|
|
}
|
|
{
|
|
value, err := b.Bool()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode quickReplyMessage#bef92f03: field can_be_edited: %w", err)
|
|
}
|
|
q.CanBeEdited = value
|
|
}
|
|
{
|
|
value, err := b.Int53()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode quickReplyMessage#bef92f03: field reply_to_message_id: %w", err)
|
|
}
|
|
q.ReplyToMessageID = value
|
|
}
|
|
{
|
|
value, err := b.Int53()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode quickReplyMessage#bef92f03: field via_bot_user_id: %w", err)
|
|
}
|
|
q.ViaBotUserID = value
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode quickReplyMessage#bef92f03: field media_album_id: %w", err)
|
|
}
|
|
q.MediaAlbumID = value
|
|
}
|
|
{
|
|
value, err := DecodeMessageContent(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode quickReplyMessage#bef92f03: field content: %w", err)
|
|
}
|
|
q.Content = value
|
|
}
|
|
{
|
|
value, err := DecodeReplyMarkup(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode quickReplyMessage#bef92f03: field reply_markup: %w", err)
|
|
}
|
|
q.ReplyMarkup = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
|
func (q *QuickReplyMessage) EncodeTDLibJSON(b tdjson.Encoder) error {
|
|
if q == nil {
|
|
return fmt.Errorf("can't encode quickReplyMessage#bef92f03 as nil")
|
|
}
|
|
b.ObjStart()
|
|
b.PutID("quickReplyMessage")
|
|
b.Comma()
|
|
b.FieldStart("id")
|
|
b.PutInt53(q.ID)
|
|
b.Comma()
|
|
b.FieldStart("sending_state")
|
|
if q.SendingState == nil {
|
|
return fmt.Errorf("unable to encode quickReplyMessage#bef92f03: field sending_state is nil")
|
|
}
|
|
if err := q.SendingState.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode quickReplyMessage#bef92f03: field sending_state: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.FieldStart("can_be_edited")
|
|
b.PutBool(q.CanBeEdited)
|
|
b.Comma()
|
|
b.FieldStart("reply_to_message_id")
|
|
b.PutInt53(q.ReplyToMessageID)
|
|
b.Comma()
|
|
b.FieldStart("via_bot_user_id")
|
|
b.PutInt53(q.ViaBotUserID)
|
|
b.Comma()
|
|
b.FieldStart("media_album_id")
|
|
b.PutLong(q.MediaAlbumID)
|
|
b.Comma()
|
|
b.FieldStart("content")
|
|
if q.Content == nil {
|
|
return fmt.Errorf("unable to encode quickReplyMessage#bef92f03: field content is nil")
|
|
}
|
|
if err := q.Content.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode quickReplyMessage#bef92f03: field content: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.FieldStart("reply_markup")
|
|
if q.ReplyMarkup == nil {
|
|
return fmt.Errorf("unable to encode quickReplyMessage#bef92f03: field reply_markup is nil")
|
|
}
|
|
if err := q.ReplyMarkup.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode quickReplyMessage#bef92f03: field reply_markup: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.StripComma()
|
|
b.ObjEnd()
|
|
return nil
|
|
}
|
|
|
|
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
|
func (q *QuickReplyMessage) DecodeTDLibJSON(b tdjson.Decoder) error {
|
|
if q == nil {
|
|
return fmt.Errorf("can't decode quickReplyMessage#bef92f03 to nil")
|
|
}
|
|
|
|
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
|
switch string(key) {
|
|
case tdjson.TypeField:
|
|
if err := b.ConsumeID("quickReplyMessage"); err != nil {
|
|
return fmt.Errorf("unable to decode quickReplyMessage#bef92f03: %w", err)
|
|
}
|
|
case "id":
|
|
value, err := b.Int53()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode quickReplyMessage#bef92f03: field id: %w", err)
|
|
}
|
|
q.ID = value
|
|
case "sending_state":
|
|
value, err := DecodeTDLibJSONMessageSendingState(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode quickReplyMessage#bef92f03: field sending_state: %w", err)
|
|
}
|
|
q.SendingState = value
|
|
case "can_be_edited":
|
|
value, err := b.Bool()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode quickReplyMessage#bef92f03: field can_be_edited: %w", err)
|
|
}
|
|
q.CanBeEdited = value
|
|
case "reply_to_message_id":
|
|
value, err := b.Int53()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode quickReplyMessage#bef92f03: field reply_to_message_id: %w", err)
|
|
}
|
|
q.ReplyToMessageID = value
|
|
case "via_bot_user_id":
|
|
value, err := b.Int53()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode quickReplyMessage#bef92f03: field via_bot_user_id: %w", err)
|
|
}
|
|
q.ViaBotUserID = value
|
|
case "media_album_id":
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode quickReplyMessage#bef92f03: field media_album_id: %w", err)
|
|
}
|
|
q.MediaAlbumID = value
|
|
case "content":
|
|
value, err := DecodeTDLibJSONMessageContent(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode quickReplyMessage#bef92f03: field content: %w", err)
|
|
}
|
|
q.Content = value
|
|
case "reply_markup":
|
|
value, err := DecodeTDLibJSONReplyMarkup(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode quickReplyMessage#bef92f03: field reply_markup: %w", err)
|
|
}
|
|
q.ReplyMarkup = value
|
|
default:
|
|
return b.Skip()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// GetID returns value of ID field.
|
|
func (q *QuickReplyMessage) GetID() (value int64) {
|
|
if q == nil {
|
|
return
|
|
}
|
|
return q.ID
|
|
}
|
|
|
|
// GetSendingState returns value of SendingState field.
|
|
func (q *QuickReplyMessage) GetSendingState() (value MessageSendingStateClass) {
|
|
if q == nil {
|
|
return
|
|
}
|
|
return q.SendingState
|
|
}
|
|
|
|
// GetCanBeEdited returns value of CanBeEdited field.
|
|
func (q *QuickReplyMessage) GetCanBeEdited() (value bool) {
|
|
if q == nil {
|
|
return
|
|
}
|
|
return q.CanBeEdited
|
|
}
|
|
|
|
// GetReplyToMessageID returns value of ReplyToMessageID field.
|
|
func (q *QuickReplyMessage) GetReplyToMessageID() (value int64) {
|
|
if q == nil {
|
|
return
|
|
}
|
|
return q.ReplyToMessageID
|
|
}
|
|
|
|
// GetViaBotUserID returns value of ViaBotUserID field.
|
|
func (q *QuickReplyMessage) GetViaBotUserID() (value int64) {
|
|
if q == nil {
|
|
return
|
|
}
|
|
return q.ViaBotUserID
|
|
}
|
|
|
|
// GetMediaAlbumID returns value of MediaAlbumID field.
|
|
func (q *QuickReplyMessage) GetMediaAlbumID() (value int64) {
|
|
if q == nil {
|
|
return
|
|
}
|
|
return q.MediaAlbumID
|
|
}
|
|
|
|
// GetContent returns value of Content field.
|
|
func (q *QuickReplyMessage) GetContent() (value MessageContentClass) {
|
|
if q == nil {
|
|
return
|
|
}
|
|
return q.Content
|
|
}
|
|
|
|
// GetReplyMarkup returns value of ReplyMarkup field.
|
|
func (q *QuickReplyMessage) GetReplyMarkup() (value ReplyMarkupClass) {
|
|
if q == nil {
|
|
return
|
|
}
|
|
return q.ReplyMarkup
|
|
}
|