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
947 lines
26 KiB
Go
947 lines
26 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{}
|
|
)
|
|
|
|
// AttachmentMenuBot represents TL type `attachmentMenuBot#b96e1bbf`.
|
|
type AttachmentMenuBot struct {
|
|
// User identifier of the bot
|
|
BotUserID int64
|
|
// True, if the bot supports opening from attachment menu in the chat with the bot
|
|
SupportsSelfChat bool
|
|
// True, if the bot supports opening from attachment menu in private chats with ordinary
|
|
// users
|
|
SupportsUserChats bool
|
|
// True, if the bot supports opening from attachment menu in private chats with other
|
|
// bots
|
|
SupportsBotChats bool
|
|
// True, if the bot supports opening from attachment menu in basic group and supergroup
|
|
// chats
|
|
SupportsGroupChats bool
|
|
// True, if the bot supports opening from attachment menu in channel chats
|
|
SupportsChannelChats bool
|
|
// True, if the user must be asked for the permission to send messages to the bot
|
|
RequestWriteAccess bool
|
|
// True, if the bot was explicitly added by the user. If the bot isn't added, then on the
|
|
// first bot launch toggleBotIsAddedToAttachmentMenu must be called and the bot must be
|
|
// added or removed
|
|
IsAdded bool
|
|
// True, if the bot must be shown in the attachment menu
|
|
ShowInAttachmentMenu bool
|
|
// True, if the bot must be shown in the side menu
|
|
ShowInSideMenu bool
|
|
// True, if a disclaimer, why the bot is shown in the side menu, is needed
|
|
ShowDisclaimerInSideMenu bool
|
|
// Name for the bot in attachment menu
|
|
Name string
|
|
// Color to highlight selected name of the bot if appropriate; may be null
|
|
NameColor AttachmentMenuBotColor
|
|
// Default icon for the bot in SVG format; may be null
|
|
DefaultIcon File
|
|
// Icon for the bot in SVG format for the official iOS app; may be null
|
|
IosStaticIcon File
|
|
// Icon for the bot in TGS format for the official iOS app; may be null
|
|
IosAnimatedIcon File
|
|
// Icon for the bot in PNG format for the official iOS app side menu; may be null
|
|
IosSideMenuIcon File
|
|
// Icon for the bot in TGS format for the official Android app; may be null
|
|
AndroidIcon File
|
|
// Icon for the bot in SVG format for the official Android app side menu; may be null
|
|
AndroidSideMenuIcon File
|
|
// Icon for the bot in TGS format for the official native macOS app; may be null
|
|
MacosIcon File
|
|
// Icon for the bot in PNG format for the official macOS app side menu; may be null
|
|
MacosSideMenuIcon File
|
|
// Color to highlight selected icon of the bot if appropriate; may be null
|
|
IconColor AttachmentMenuBotColor
|
|
// Default placeholder for opened Web Apps in SVG format; may be null
|
|
WebAppPlaceholder File
|
|
}
|
|
|
|
// AttachmentMenuBotTypeID is TL type id of AttachmentMenuBot.
|
|
const AttachmentMenuBotTypeID = 0xb96e1bbf
|
|
|
|
// Ensuring interfaces in compile-time for AttachmentMenuBot.
|
|
var (
|
|
_ bin.Encoder = &AttachmentMenuBot{}
|
|
_ bin.Decoder = &AttachmentMenuBot{}
|
|
_ bin.BareEncoder = &AttachmentMenuBot{}
|
|
_ bin.BareDecoder = &AttachmentMenuBot{}
|
|
)
|
|
|
|
func (a *AttachmentMenuBot) Zero() bool {
|
|
if a == nil {
|
|
return true
|
|
}
|
|
if !(a.BotUserID == 0) {
|
|
return false
|
|
}
|
|
if !(a.SupportsSelfChat == false) {
|
|
return false
|
|
}
|
|
if !(a.SupportsUserChats == false) {
|
|
return false
|
|
}
|
|
if !(a.SupportsBotChats == false) {
|
|
return false
|
|
}
|
|
if !(a.SupportsGroupChats == false) {
|
|
return false
|
|
}
|
|
if !(a.SupportsChannelChats == false) {
|
|
return false
|
|
}
|
|
if !(a.RequestWriteAccess == false) {
|
|
return false
|
|
}
|
|
if !(a.IsAdded == false) {
|
|
return false
|
|
}
|
|
if !(a.ShowInAttachmentMenu == false) {
|
|
return false
|
|
}
|
|
if !(a.ShowInSideMenu == false) {
|
|
return false
|
|
}
|
|
if !(a.ShowDisclaimerInSideMenu == false) {
|
|
return false
|
|
}
|
|
if !(a.Name == "") {
|
|
return false
|
|
}
|
|
if !(a.NameColor.Zero()) {
|
|
return false
|
|
}
|
|
if !(a.DefaultIcon.Zero()) {
|
|
return false
|
|
}
|
|
if !(a.IosStaticIcon.Zero()) {
|
|
return false
|
|
}
|
|
if !(a.IosAnimatedIcon.Zero()) {
|
|
return false
|
|
}
|
|
if !(a.IosSideMenuIcon.Zero()) {
|
|
return false
|
|
}
|
|
if !(a.AndroidIcon.Zero()) {
|
|
return false
|
|
}
|
|
if !(a.AndroidSideMenuIcon.Zero()) {
|
|
return false
|
|
}
|
|
if !(a.MacosIcon.Zero()) {
|
|
return false
|
|
}
|
|
if !(a.MacosSideMenuIcon.Zero()) {
|
|
return false
|
|
}
|
|
if !(a.IconColor.Zero()) {
|
|
return false
|
|
}
|
|
if !(a.WebAppPlaceholder.Zero()) {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (a *AttachmentMenuBot) String() string {
|
|
if a == nil {
|
|
return "AttachmentMenuBot(nil)"
|
|
}
|
|
type Alias AttachmentMenuBot
|
|
return fmt.Sprintf("AttachmentMenuBot%+v", Alias(*a))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*AttachmentMenuBot) TypeID() uint32 {
|
|
return AttachmentMenuBotTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*AttachmentMenuBot) TypeName() string {
|
|
return "attachmentMenuBot"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (a *AttachmentMenuBot) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "attachmentMenuBot",
|
|
ID: AttachmentMenuBotTypeID,
|
|
}
|
|
if a == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "BotUserID",
|
|
SchemaName: "bot_user_id",
|
|
},
|
|
{
|
|
Name: "SupportsSelfChat",
|
|
SchemaName: "supports_self_chat",
|
|
},
|
|
{
|
|
Name: "SupportsUserChats",
|
|
SchemaName: "supports_user_chats",
|
|
},
|
|
{
|
|
Name: "SupportsBotChats",
|
|
SchemaName: "supports_bot_chats",
|
|
},
|
|
{
|
|
Name: "SupportsGroupChats",
|
|
SchemaName: "supports_group_chats",
|
|
},
|
|
{
|
|
Name: "SupportsChannelChats",
|
|
SchemaName: "supports_channel_chats",
|
|
},
|
|
{
|
|
Name: "RequestWriteAccess",
|
|
SchemaName: "request_write_access",
|
|
},
|
|
{
|
|
Name: "IsAdded",
|
|
SchemaName: "is_added",
|
|
},
|
|
{
|
|
Name: "ShowInAttachmentMenu",
|
|
SchemaName: "show_in_attachment_menu",
|
|
},
|
|
{
|
|
Name: "ShowInSideMenu",
|
|
SchemaName: "show_in_side_menu",
|
|
},
|
|
{
|
|
Name: "ShowDisclaimerInSideMenu",
|
|
SchemaName: "show_disclaimer_in_side_menu",
|
|
},
|
|
{
|
|
Name: "Name",
|
|
SchemaName: "name",
|
|
},
|
|
{
|
|
Name: "NameColor",
|
|
SchemaName: "name_color",
|
|
},
|
|
{
|
|
Name: "DefaultIcon",
|
|
SchemaName: "default_icon",
|
|
},
|
|
{
|
|
Name: "IosStaticIcon",
|
|
SchemaName: "ios_static_icon",
|
|
},
|
|
{
|
|
Name: "IosAnimatedIcon",
|
|
SchemaName: "ios_animated_icon",
|
|
},
|
|
{
|
|
Name: "IosSideMenuIcon",
|
|
SchemaName: "ios_side_menu_icon",
|
|
},
|
|
{
|
|
Name: "AndroidIcon",
|
|
SchemaName: "android_icon",
|
|
},
|
|
{
|
|
Name: "AndroidSideMenuIcon",
|
|
SchemaName: "android_side_menu_icon",
|
|
},
|
|
{
|
|
Name: "MacosIcon",
|
|
SchemaName: "macos_icon",
|
|
},
|
|
{
|
|
Name: "MacosSideMenuIcon",
|
|
SchemaName: "macos_side_menu_icon",
|
|
},
|
|
{
|
|
Name: "IconColor",
|
|
SchemaName: "icon_color",
|
|
},
|
|
{
|
|
Name: "WebAppPlaceholder",
|
|
SchemaName: "web_app_placeholder",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (a *AttachmentMenuBot) Encode(b *bin.Buffer) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't encode attachmentMenuBot#b96e1bbf as nil")
|
|
}
|
|
b.PutID(AttachmentMenuBotTypeID)
|
|
return a.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (a *AttachmentMenuBot) EncodeBare(b *bin.Buffer) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't encode attachmentMenuBot#b96e1bbf as nil")
|
|
}
|
|
b.PutInt53(a.BotUserID)
|
|
b.PutBool(a.SupportsSelfChat)
|
|
b.PutBool(a.SupportsUserChats)
|
|
b.PutBool(a.SupportsBotChats)
|
|
b.PutBool(a.SupportsGroupChats)
|
|
b.PutBool(a.SupportsChannelChats)
|
|
b.PutBool(a.RequestWriteAccess)
|
|
b.PutBool(a.IsAdded)
|
|
b.PutBool(a.ShowInAttachmentMenu)
|
|
b.PutBool(a.ShowInSideMenu)
|
|
b.PutBool(a.ShowDisclaimerInSideMenu)
|
|
b.PutString(a.Name)
|
|
if err := a.NameColor.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode attachmentMenuBot#b96e1bbf: field name_color: %w", err)
|
|
}
|
|
if err := a.DefaultIcon.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode attachmentMenuBot#b96e1bbf: field default_icon: %w", err)
|
|
}
|
|
if err := a.IosStaticIcon.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode attachmentMenuBot#b96e1bbf: field ios_static_icon: %w", err)
|
|
}
|
|
if err := a.IosAnimatedIcon.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode attachmentMenuBot#b96e1bbf: field ios_animated_icon: %w", err)
|
|
}
|
|
if err := a.IosSideMenuIcon.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode attachmentMenuBot#b96e1bbf: field ios_side_menu_icon: %w", err)
|
|
}
|
|
if err := a.AndroidIcon.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode attachmentMenuBot#b96e1bbf: field android_icon: %w", err)
|
|
}
|
|
if err := a.AndroidSideMenuIcon.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode attachmentMenuBot#b96e1bbf: field android_side_menu_icon: %w", err)
|
|
}
|
|
if err := a.MacosIcon.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode attachmentMenuBot#b96e1bbf: field macos_icon: %w", err)
|
|
}
|
|
if err := a.MacosSideMenuIcon.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode attachmentMenuBot#b96e1bbf: field macos_side_menu_icon: %w", err)
|
|
}
|
|
if err := a.IconColor.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode attachmentMenuBot#b96e1bbf: field icon_color: %w", err)
|
|
}
|
|
if err := a.WebAppPlaceholder.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode attachmentMenuBot#b96e1bbf: field web_app_placeholder: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (a *AttachmentMenuBot) Decode(b *bin.Buffer) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't decode attachmentMenuBot#b96e1bbf to nil")
|
|
}
|
|
if err := b.ConsumeID(AttachmentMenuBotTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: %w", err)
|
|
}
|
|
return a.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (a *AttachmentMenuBot) DecodeBare(b *bin.Buffer) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't decode attachmentMenuBot#b96e1bbf to nil")
|
|
}
|
|
{
|
|
value, err := b.Int53()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field bot_user_id: %w", err)
|
|
}
|
|
a.BotUserID = value
|
|
}
|
|
{
|
|
value, err := b.Bool()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field supports_self_chat: %w", err)
|
|
}
|
|
a.SupportsSelfChat = value
|
|
}
|
|
{
|
|
value, err := b.Bool()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field supports_user_chats: %w", err)
|
|
}
|
|
a.SupportsUserChats = value
|
|
}
|
|
{
|
|
value, err := b.Bool()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field supports_bot_chats: %w", err)
|
|
}
|
|
a.SupportsBotChats = value
|
|
}
|
|
{
|
|
value, err := b.Bool()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field supports_group_chats: %w", err)
|
|
}
|
|
a.SupportsGroupChats = value
|
|
}
|
|
{
|
|
value, err := b.Bool()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field supports_channel_chats: %w", err)
|
|
}
|
|
a.SupportsChannelChats = value
|
|
}
|
|
{
|
|
value, err := b.Bool()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field request_write_access: %w", err)
|
|
}
|
|
a.RequestWriteAccess = value
|
|
}
|
|
{
|
|
value, err := b.Bool()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field is_added: %w", err)
|
|
}
|
|
a.IsAdded = value
|
|
}
|
|
{
|
|
value, err := b.Bool()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field show_in_attachment_menu: %w", err)
|
|
}
|
|
a.ShowInAttachmentMenu = value
|
|
}
|
|
{
|
|
value, err := b.Bool()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field show_in_side_menu: %w", err)
|
|
}
|
|
a.ShowInSideMenu = value
|
|
}
|
|
{
|
|
value, err := b.Bool()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field show_disclaimer_in_side_menu: %w", err)
|
|
}
|
|
a.ShowDisclaimerInSideMenu = value
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field name: %w", err)
|
|
}
|
|
a.Name = value
|
|
}
|
|
{
|
|
if err := a.NameColor.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field name_color: %w", err)
|
|
}
|
|
}
|
|
{
|
|
if err := a.DefaultIcon.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field default_icon: %w", err)
|
|
}
|
|
}
|
|
{
|
|
if err := a.IosStaticIcon.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field ios_static_icon: %w", err)
|
|
}
|
|
}
|
|
{
|
|
if err := a.IosAnimatedIcon.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field ios_animated_icon: %w", err)
|
|
}
|
|
}
|
|
{
|
|
if err := a.IosSideMenuIcon.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field ios_side_menu_icon: %w", err)
|
|
}
|
|
}
|
|
{
|
|
if err := a.AndroidIcon.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field android_icon: %w", err)
|
|
}
|
|
}
|
|
{
|
|
if err := a.AndroidSideMenuIcon.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field android_side_menu_icon: %w", err)
|
|
}
|
|
}
|
|
{
|
|
if err := a.MacosIcon.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field macos_icon: %w", err)
|
|
}
|
|
}
|
|
{
|
|
if err := a.MacosSideMenuIcon.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field macos_side_menu_icon: %w", err)
|
|
}
|
|
}
|
|
{
|
|
if err := a.IconColor.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field icon_color: %w", err)
|
|
}
|
|
}
|
|
{
|
|
if err := a.WebAppPlaceholder.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field web_app_placeholder: %w", err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
|
func (a *AttachmentMenuBot) EncodeTDLibJSON(b tdjson.Encoder) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't encode attachmentMenuBot#b96e1bbf as nil")
|
|
}
|
|
b.ObjStart()
|
|
b.PutID("attachmentMenuBot")
|
|
b.Comma()
|
|
b.FieldStart("bot_user_id")
|
|
b.PutInt53(a.BotUserID)
|
|
b.Comma()
|
|
b.FieldStart("supports_self_chat")
|
|
b.PutBool(a.SupportsSelfChat)
|
|
b.Comma()
|
|
b.FieldStart("supports_user_chats")
|
|
b.PutBool(a.SupportsUserChats)
|
|
b.Comma()
|
|
b.FieldStart("supports_bot_chats")
|
|
b.PutBool(a.SupportsBotChats)
|
|
b.Comma()
|
|
b.FieldStart("supports_group_chats")
|
|
b.PutBool(a.SupportsGroupChats)
|
|
b.Comma()
|
|
b.FieldStart("supports_channel_chats")
|
|
b.PutBool(a.SupportsChannelChats)
|
|
b.Comma()
|
|
b.FieldStart("request_write_access")
|
|
b.PutBool(a.RequestWriteAccess)
|
|
b.Comma()
|
|
b.FieldStart("is_added")
|
|
b.PutBool(a.IsAdded)
|
|
b.Comma()
|
|
b.FieldStart("show_in_attachment_menu")
|
|
b.PutBool(a.ShowInAttachmentMenu)
|
|
b.Comma()
|
|
b.FieldStart("show_in_side_menu")
|
|
b.PutBool(a.ShowInSideMenu)
|
|
b.Comma()
|
|
b.FieldStart("show_disclaimer_in_side_menu")
|
|
b.PutBool(a.ShowDisclaimerInSideMenu)
|
|
b.Comma()
|
|
b.FieldStart("name")
|
|
b.PutString(a.Name)
|
|
b.Comma()
|
|
b.FieldStart("name_color")
|
|
if err := a.NameColor.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode attachmentMenuBot#b96e1bbf: field name_color: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.FieldStart("default_icon")
|
|
if err := a.DefaultIcon.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode attachmentMenuBot#b96e1bbf: field default_icon: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.FieldStart("ios_static_icon")
|
|
if err := a.IosStaticIcon.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode attachmentMenuBot#b96e1bbf: field ios_static_icon: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.FieldStart("ios_animated_icon")
|
|
if err := a.IosAnimatedIcon.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode attachmentMenuBot#b96e1bbf: field ios_animated_icon: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.FieldStart("ios_side_menu_icon")
|
|
if err := a.IosSideMenuIcon.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode attachmentMenuBot#b96e1bbf: field ios_side_menu_icon: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.FieldStart("android_icon")
|
|
if err := a.AndroidIcon.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode attachmentMenuBot#b96e1bbf: field android_icon: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.FieldStart("android_side_menu_icon")
|
|
if err := a.AndroidSideMenuIcon.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode attachmentMenuBot#b96e1bbf: field android_side_menu_icon: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.FieldStart("macos_icon")
|
|
if err := a.MacosIcon.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode attachmentMenuBot#b96e1bbf: field macos_icon: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.FieldStart("macos_side_menu_icon")
|
|
if err := a.MacosSideMenuIcon.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode attachmentMenuBot#b96e1bbf: field macos_side_menu_icon: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.FieldStart("icon_color")
|
|
if err := a.IconColor.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode attachmentMenuBot#b96e1bbf: field icon_color: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.FieldStart("web_app_placeholder")
|
|
if err := a.WebAppPlaceholder.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode attachmentMenuBot#b96e1bbf: field web_app_placeholder: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.StripComma()
|
|
b.ObjEnd()
|
|
return nil
|
|
}
|
|
|
|
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
|
func (a *AttachmentMenuBot) DecodeTDLibJSON(b tdjson.Decoder) error {
|
|
if a == nil {
|
|
return fmt.Errorf("can't decode attachmentMenuBot#b96e1bbf to nil")
|
|
}
|
|
|
|
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
|
switch string(key) {
|
|
case tdjson.TypeField:
|
|
if err := b.ConsumeID("attachmentMenuBot"); err != nil {
|
|
return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: %w", err)
|
|
}
|
|
case "bot_user_id":
|
|
value, err := b.Int53()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field bot_user_id: %w", err)
|
|
}
|
|
a.BotUserID = value
|
|
case "supports_self_chat":
|
|
value, err := b.Bool()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field supports_self_chat: %w", err)
|
|
}
|
|
a.SupportsSelfChat = value
|
|
case "supports_user_chats":
|
|
value, err := b.Bool()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field supports_user_chats: %w", err)
|
|
}
|
|
a.SupportsUserChats = value
|
|
case "supports_bot_chats":
|
|
value, err := b.Bool()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field supports_bot_chats: %w", err)
|
|
}
|
|
a.SupportsBotChats = value
|
|
case "supports_group_chats":
|
|
value, err := b.Bool()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field supports_group_chats: %w", err)
|
|
}
|
|
a.SupportsGroupChats = value
|
|
case "supports_channel_chats":
|
|
value, err := b.Bool()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field supports_channel_chats: %w", err)
|
|
}
|
|
a.SupportsChannelChats = value
|
|
case "request_write_access":
|
|
value, err := b.Bool()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field request_write_access: %w", err)
|
|
}
|
|
a.RequestWriteAccess = value
|
|
case "is_added":
|
|
value, err := b.Bool()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field is_added: %w", err)
|
|
}
|
|
a.IsAdded = value
|
|
case "show_in_attachment_menu":
|
|
value, err := b.Bool()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field show_in_attachment_menu: %w", err)
|
|
}
|
|
a.ShowInAttachmentMenu = value
|
|
case "show_in_side_menu":
|
|
value, err := b.Bool()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field show_in_side_menu: %w", err)
|
|
}
|
|
a.ShowInSideMenu = value
|
|
case "show_disclaimer_in_side_menu":
|
|
value, err := b.Bool()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field show_disclaimer_in_side_menu: %w", err)
|
|
}
|
|
a.ShowDisclaimerInSideMenu = value
|
|
case "name":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field name: %w", err)
|
|
}
|
|
a.Name = value
|
|
case "name_color":
|
|
if err := a.NameColor.DecodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field name_color: %w", err)
|
|
}
|
|
case "default_icon":
|
|
if err := a.DefaultIcon.DecodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field default_icon: %w", err)
|
|
}
|
|
case "ios_static_icon":
|
|
if err := a.IosStaticIcon.DecodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field ios_static_icon: %w", err)
|
|
}
|
|
case "ios_animated_icon":
|
|
if err := a.IosAnimatedIcon.DecodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field ios_animated_icon: %w", err)
|
|
}
|
|
case "ios_side_menu_icon":
|
|
if err := a.IosSideMenuIcon.DecodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field ios_side_menu_icon: %w", err)
|
|
}
|
|
case "android_icon":
|
|
if err := a.AndroidIcon.DecodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field android_icon: %w", err)
|
|
}
|
|
case "android_side_menu_icon":
|
|
if err := a.AndroidSideMenuIcon.DecodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field android_side_menu_icon: %w", err)
|
|
}
|
|
case "macos_icon":
|
|
if err := a.MacosIcon.DecodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field macos_icon: %w", err)
|
|
}
|
|
case "macos_side_menu_icon":
|
|
if err := a.MacosSideMenuIcon.DecodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field macos_side_menu_icon: %w", err)
|
|
}
|
|
case "icon_color":
|
|
if err := a.IconColor.DecodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field icon_color: %w", err)
|
|
}
|
|
case "web_app_placeholder":
|
|
if err := a.WebAppPlaceholder.DecodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field web_app_placeholder: %w", err)
|
|
}
|
|
default:
|
|
return b.Skip()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// GetBotUserID returns value of BotUserID field.
|
|
func (a *AttachmentMenuBot) GetBotUserID() (value int64) {
|
|
if a == nil {
|
|
return
|
|
}
|
|
return a.BotUserID
|
|
}
|
|
|
|
// GetSupportsSelfChat returns value of SupportsSelfChat field.
|
|
func (a *AttachmentMenuBot) GetSupportsSelfChat() (value bool) {
|
|
if a == nil {
|
|
return
|
|
}
|
|
return a.SupportsSelfChat
|
|
}
|
|
|
|
// GetSupportsUserChats returns value of SupportsUserChats field.
|
|
func (a *AttachmentMenuBot) GetSupportsUserChats() (value bool) {
|
|
if a == nil {
|
|
return
|
|
}
|
|
return a.SupportsUserChats
|
|
}
|
|
|
|
// GetSupportsBotChats returns value of SupportsBotChats field.
|
|
func (a *AttachmentMenuBot) GetSupportsBotChats() (value bool) {
|
|
if a == nil {
|
|
return
|
|
}
|
|
return a.SupportsBotChats
|
|
}
|
|
|
|
// GetSupportsGroupChats returns value of SupportsGroupChats field.
|
|
func (a *AttachmentMenuBot) GetSupportsGroupChats() (value bool) {
|
|
if a == nil {
|
|
return
|
|
}
|
|
return a.SupportsGroupChats
|
|
}
|
|
|
|
// GetSupportsChannelChats returns value of SupportsChannelChats field.
|
|
func (a *AttachmentMenuBot) GetSupportsChannelChats() (value bool) {
|
|
if a == nil {
|
|
return
|
|
}
|
|
return a.SupportsChannelChats
|
|
}
|
|
|
|
// GetRequestWriteAccess returns value of RequestWriteAccess field.
|
|
func (a *AttachmentMenuBot) GetRequestWriteAccess() (value bool) {
|
|
if a == nil {
|
|
return
|
|
}
|
|
return a.RequestWriteAccess
|
|
}
|
|
|
|
// GetIsAdded returns value of IsAdded field.
|
|
func (a *AttachmentMenuBot) GetIsAdded() (value bool) {
|
|
if a == nil {
|
|
return
|
|
}
|
|
return a.IsAdded
|
|
}
|
|
|
|
// GetShowInAttachmentMenu returns value of ShowInAttachmentMenu field.
|
|
func (a *AttachmentMenuBot) GetShowInAttachmentMenu() (value bool) {
|
|
if a == nil {
|
|
return
|
|
}
|
|
return a.ShowInAttachmentMenu
|
|
}
|
|
|
|
// GetShowInSideMenu returns value of ShowInSideMenu field.
|
|
func (a *AttachmentMenuBot) GetShowInSideMenu() (value bool) {
|
|
if a == nil {
|
|
return
|
|
}
|
|
return a.ShowInSideMenu
|
|
}
|
|
|
|
// GetShowDisclaimerInSideMenu returns value of ShowDisclaimerInSideMenu field.
|
|
func (a *AttachmentMenuBot) GetShowDisclaimerInSideMenu() (value bool) {
|
|
if a == nil {
|
|
return
|
|
}
|
|
return a.ShowDisclaimerInSideMenu
|
|
}
|
|
|
|
// GetName returns value of Name field.
|
|
func (a *AttachmentMenuBot) GetName() (value string) {
|
|
if a == nil {
|
|
return
|
|
}
|
|
return a.Name
|
|
}
|
|
|
|
// GetNameColor returns value of NameColor field.
|
|
func (a *AttachmentMenuBot) GetNameColor() (value AttachmentMenuBotColor) {
|
|
if a == nil {
|
|
return
|
|
}
|
|
return a.NameColor
|
|
}
|
|
|
|
// GetDefaultIcon returns value of DefaultIcon field.
|
|
func (a *AttachmentMenuBot) GetDefaultIcon() (value File) {
|
|
if a == nil {
|
|
return
|
|
}
|
|
return a.DefaultIcon
|
|
}
|
|
|
|
// GetIosStaticIcon returns value of IosStaticIcon field.
|
|
func (a *AttachmentMenuBot) GetIosStaticIcon() (value File) {
|
|
if a == nil {
|
|
return
|
|
}
|
|
return a.IosStaticIcon
|
|
}
|
|
|
|
// GetIosAnimatedIcon returns value of IosAnimatedIcon field.
|
|
func (a *AttachmentMenuBot) GetIosAnimatedIcon() (value File) {
|
|
if a == nil {
|
|
return
|
|
}
|
|
return a.IosAnimatedIcon
|
|
}
|
|
|
|
// GetIosSideMenuIcon returns value of IosSideMenuIcon field.
|
|
func (a *AttachmentMenuBot) GetIosSideMenuIcon() (value File) {
|
|
if a == nil {
|
|
return
|
|
}
|
|
return a.IosSideMenuIcon
|
|
}
|
|
|
|
// GetAndroidIcon returns value of AndroidIcon field.
|
|
func (a *AttachmentMenuBot) GetAndroidIcon() (value File) {
|
|
if a == nil {
|
|
return
|
|
}
|
|
return a.AndroidIcon
|
|
}
|
|
|
|
// GetAndroidSideMenuIcon returns value of AndroidSideMenuIcon field.
|
|
func (a *AttachmentMenuBot) GetAndroidSideMenuIcon() (value File) {
|
|
if a == nil {
|
|
return
|
|
}
|
|
return a.AndroidSideMenuIcon
|
|
}
|
|
|
|
// GetMacosIcon returns value of MacosIcon field.
|
|
func (a *AttachmentMenuBot) GetMacosIcon() (value File) {
|
|
if a == nil {
|
|
return
|
|
}
|
|
return a.MacosIcon
|
|
}
|
|
|
|
// GetMacosSideMenuIcon returns value of MacosSideMenuIcon field.
|
|
func (a *AttachmentMenuBot) GetMacosSideMenuIcon() (value File) {
|
|
if a == nil {
|
|
return
|
|
}
|
|
return a.MacosSideMenuIcon
|
|
}
|
|
|
|
// GetIconColor returns value of IconColor field.
|
|
func (a *AttachmentMenuBot) GetIconColor() (value AttachmentMenuBotColor) {
|
|
if a == nil {
|
|
return
|
|
}
|
|
return a.IconColor
|
|
}
|
|
|
|
// GetWebAppPlaceholder returns value of WebAppPlaceholder field.
|
|
func (a *AttachmentMenuBot) GetWebAppPlaceholder() (value File) {
|
|
if a == nil {
|
|
return
|
|
}
|
|
return a.WebAppPlaceholder
|
|
}
|