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
1682 lines
45 KiB
Go
1682 lines
45 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{}
|
|
)
|
|
|
|
// Chat represents TL type `chat#e5bae2e4`.
|
|
type Chat struct {
|
|
// Chat unique identifier
|
|
ID int64
|
|
// Type of the chat
|
|
Type ChatTypeClass
|
|
// Chat title
|
|
Title string
|
|
// Chat photo; may be null
|
|
Photo ChatPhotoInfo
|
|
// Identifier of the accent color for message sender name, and backgrounds of chat photo,
|
|
// reply header, and link preview
|
|
AccentColorID int32
|
|
// Identifier of a custom emoji to be shown on the reply header and link preview
|
|
// background for messages sent by the chat; 0 if none
|
|
BackgroundCustomEmojiID int64
|
|
// Identifier of the profile accent color for the chat's profile; -1 if none
|
|
ProfileAccentColorID int32
|
|
// Identifier of a custom emoji to be shown on the background of the chat's profile; 0 if
|
|
// none
|
|
ProfileBackgroundCustomEmojiID int64
|
|
// Actions that non-administrator chat members are allowed to take in the chat
|
|
Permissions ChatPermissions
|
|
// Last message in the chat; may be null if none or unknown
|
|
LastMessage Message
|
|
// Positions of the chat in chat lists
|
|
Positions []ChatPosition
|
|
// Chat lists to which the chat belongs. A chat can have a non-zero position in a chat
|
|
// list even it doesn't belong to the chat list and have no position in a chat list even
|
|
// it belongs to the chat list
|
|
ChatLists []ChatListClass
|
|
// Identifier of a user or chat that is selected to send messages in the chat; may be
|
|
// null if the user can't change message sender
|
|
MessageSenderID MessageSenderClass
|
|
// Block list to which the chat is added; may be null if none
|
|
BlockList BlockListClass
|
|
// True, if chat content can't be saved locally, forwarded, or copied
|
|
HasProtectedContent bool
|
|
// True, if translation of all messages in the chat must be suggested to the user
|
|
IsTranslatable bool
|
|
// True, if the chat is marked as unread
|
|
IsMarkedAsUnread bool
|
|
// True, if the chat is a forum supergroup that must be shown in the "View as topics"
|
|
// mode, or Saved Messages chat that must be shown in the "View as chats"
|
|
ViewAsTopics bool
|
|
// True, if the chat has scheduled messages
|
|
HasScheduledMessages bool
|
|
// True, if the chat messages can be deleted only for the current user while other users
|
|
// will continue to see the messages
|
|
CanBeDeletedOnlyForSelf bool
|
|
// True, if the chat messages can be deleted for all users
|
|
CanBeDeletedForAllUsers bool
|
|
// True, if the chat can be reported to Telegram moderators through reportChat or
|
|
// reportChatPhoto
|
|
CanBeReported bool
|
|
// Default value of the disable_notification parameter, used when a message is sent to
|
|
// the chat
|
|
DefaultDisableNotification bool
|
|
// Number of unread messages in the chat
|
|
UnreadCount int32
|
|
// Identifier of the last read incoming message
|
|
LastReadInboxMessageID int64
|
|
// Identifier of the last read outgoing message
|
|
LastReadOutboxMessageID int64
|
|
// Number of unread messages with a mention/reply in the chat
|
|
UnreadMentionCount int32
|
|
// Number of messages with unread reactions in the chat
|
|
UnreadReactionCount int32
|
|
// Notification settings for the chat
|
|
NotificationSettings ChatNotificationSettings
|
|
// Types of reaction, available in the chat
|
|
AvailableReactions ChatAvailableReactionsClass
|
|
// Current message auto-delete or self-destruct timer setting for the chat, in seconds; 0
|
|
// if disabled. Self-destruct timer in secret chats starts after the message or its
|
|
// content is viewed. Auto-delete timer in other chats starts from the send date
|
|
MessageAutoDeleteTime int32
|
|
// Emoji status to be shown along with chat title; may be null
|
|
EmojiStatus EmojiStatus
|
|
// Background set for the chat; may be null if none
|
|
Background ChatBackground
|
|
// If non-empty, name of a theme, set for the chat
|
|
ThemeName string
|
|
// Information about actions which must be possible to do through the chat action bar;
|
|
// may be null if none
|
|
ActionBar ChatActionBarClass
|
|
// Information about bar for managing a business bot in the chat; may be null if none
|
|
BusinessBotManageBar BusinessBotManageBar
|
|
// Information about video chat of the chat
|
|
VideoChat VideoChat
|
|
// Information about pending join requests; may be null if none
|
|
PendingJoinRequests ChatJoinRequestsInfo
|
|
// Identifier of the message from which reply markup needs to be used; 0 if there is no
|
|
// default custom reply markup in the chat
|
|
ReplyMarkupMessageID int64
|
|
// A draft of a message in the chat; may be null if none
|
|
DraftMessage DraftMessage
|
|
// Application-specific data associated with the chat. (For example, the chat scroll
|
|
// position or local chat notification settings can be stored here.) Persistent if the
|
|
// message database is used
|
|
ClientData string
|
|
}
|
|
|
|
// ChatTypeID is TL type id of Chat.
|
|
const ChatTypeID = 0xe5bae2e4
|
|
|
|
// Ensuring interfaces in compile-time for Chat.
|
|
var (
|
|
_ bin.Encoder = &Chat{}
|
|
_ bin.Decoder = &Chat{}
|
|
_ bin.BareEncoder = &Chat{}
|
|
_ bin.BareDecoder = &Chat{}
|
|
)
|
|
|
|
func (c *Chat) Zero() bool {
|
|
if c == nil {
|
|
return true
|
|
}
|
|
if !(c.ID == 0) {
|
|
return false
|
|
}
|
|
if !(c.Type == nil) {
|
|
return false
|
|
}
|
|
if !(c.Title == "") {
|
|
return false
|
|
}
|
|
if !(c.Photo.Zero()) {
|
|
return false
|
|
}
|
|
if !(c.AccentColorID == 0) {
|
|
return false
|
|
}
|
|
if !(c.BackgroundCustomEmojiID == 0) {
|
|
return false
|
|
}
|
|
if !(c.ProfileAccentColorID == 0) {
|
|
return false
|
|
}
|
|
if !(c.ProfileBackgroundCustomEmojiID == 0) {
|
|
return false
|
|
}
|
|
if !(c.Permissions.Zero()) {
|
|
return false
|
|
}
|
|
if !(c.LastMessage.Zero()) {
|
|
return false
|
|
}
|
|
if !(c.Positions == nil) {
|
|
return false
|
|
}
|
|
if !(c.ChatLists == nil) {
|
|
return false
|
|
}
|
|
if !(c.MessageSenderID == nil) {
|
|
return false
|
|
}
|
|
if !(c.BlockList == nil) {
|
|
return false
|
|
}
|
|
if !(c.HasProtectedContent == false) {
|
|
return false
|
|
}
|
|
if !(c.IsTranslatable == false) {
|
|
return false
|
|
}
|
|
if !(c.IsMarkedAsUnread == false) {
|
|
return false
|
|
}
|
|
if !(c.ViewAsTopics == false) {
|
|
return false
|
|
}
|
|
if !(c.HasScheduledMessages == false) {
|
|
return false
|
|
}
|
|
if !(c.CanBeDeletedOnlyForSelf == false) {
|
|
return false
|
|
}
|
|
if !(c.CanBeDeletedForAllUsers == false) {
|
|
return false
|
|
}
|
|
if !(c.CanBeReported == false) {
|
|
return false
|
|
}
|
|
if !(c.DefaultDisableNotification == false) {
|
|
return false
|
|
}
|
|
if !(c.UnreadCount == 0) {
|
|
return false
|
|
}
|
|
if !(c.LastReadInboxMessageID == 0) {
|
|
return false
|
|
}
|
|
if !(c.LastReadOutboxMessageID == 0) {
|
|
return false
|
|
}
|
|
if !(c.UnreadMentionCount == 0) {
|
|
return false
|
|
}
|
|
if !(c.UnreadReactionCount == 0) {
|
|
return false
|
|
}
|
|
if !(c.NotificationSettings.Zero()) {
|
|
return false
|
|
}
|
|
if !(c.AvailableReactions == nil) {
|
|
return false
|
|
}
|
|
if !(c.MessageAutoDeleteTime == 0) {
|
|
return false
|
|
}
|
|
if !(c.EmojiStatus.Zero()) {
|
|
return false
|
|
}
|
|
if !(c.Background.Zero()) {
|
|
return false
|
|
}
|
|
if !(c.ThemeName == "") {
|
|
return false
|
|
}
|
|
if !(c.ActionBar == nil) {
|
|
return false
|
|
}
|
|
if !(c.BusinessBotManageBar.Zero()) {
|
|
return false
|
|
}
|
|
if !(c.VideoChat.Zero()) {
|
|
return false
|
|
}
|
|
if !(c.PendingJoinRequests.Zero()) {
|
|
return false
|
|
}
|
|
if !(c.ReplyMarkupMessageID == 0) {
|
|
return false
|
|
}
|
|
if !(c.DraftMessage.Zero()) {
|
|
return false
|
|
}
|
|
if !(c.ClientData == "") {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// String implements fmt.Stringer.
|
|
func (c *Chat) String() string {
|
|
if c == nil {
|
|
return "Chat(nil)"
|
|
}
|
|
type Alias Chat
|
|
return fmt.Sprintf("Chat%+v", Alias(*c))
|
|
}
|
|
|
|
// TypeID returns type id in TL schema.
|
|
//
|
|
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
|
func (*Chat) TypeID() uint32 {
|
|
return ChatTypeID
|
|
}
|
|
|
|
// TypeName returns name of type in TL schema.
|
|
func (*Chat) TypeName() string {
|
|
return "chat"
|
|
}
|
|
|
|
// TypeInfo returns info about TL type.
|
|
func (c *Chat) TypeInfo() tdp.Type {
|
|
typ := tdp.Type{
|
|
Name: "chat",
|
|
ID: ChatTypeID,
|
|
}
|
|
if c == nil {
|
|
typ.Null = true
|
|
return typ
|
|
}
|
|
typ.Fields = []tdp.Field{
|
|
{
|
|
Name: "ID",
|
|
SchemaName: "id",
|
|
},
|
|
{
|
|
Name: "Type",
|
|
SchemaName: "type",
|
|
},
|
|
{
|
|
Name: "Title",
|
|
SchemaName: "title",
|
|
},
|
|
{
|
|
Name: "Photo",
|
|
SchemaName: "photo",
|
|
},
|
|
{
|
|
Name: "AccentColorID",
|
|
SchemaName: "accent_color_id",
|
|
},
|
|
{
|
|
Name: "BackgroundCustomEmojiID",
|
|
SchemaName: "background_custom_emoji_id",
|
|
},
|
|
{
|
|
Name: "ProfileAccentColorID",
|
|
SchemaName: "profile_accent_color_id",
|
|
},
|
|
{
|
|
Name: "ProfileBackgroundCustomEmojiID",
|
|
SchemaName: "profile_background_custom_emoji_id",
|
|
},
|
|
{
|
|
Name: "Permissions",
|
|
SchemaName: "permissions",
|
|
},
|
|
{
|
|
Name: "LastMessage",
|
|
SchemaName: "last_message",
|
|
},
|
|
{
|
|
Name: "Positions",
|
|
SchemaName: "positions",
|
|
},
|
|
{
|
|
Name: "ChatLists",
|
|
SchemaName: "chat_lists",
|
|
},
|
|
{
|
|
Name: "MessageSenderID",
|
|
SchemaName: "message_sender_id",
|
|
},
|
|
{
|
|
Name: "BlockList",
|
|
SchemaName: "block_list",
|
|
},
|
|
{
|
|
Name: "HasProtectedContent",
|
|
SchemaName: "has_protected_content",
|
|
},
|
|
{
|
|
Name: "IsTranslatable",
|
|
SchemaName: "is_translatable",
|
|
},
|
|
{
|
|
Name: "IsMarkedAsUnread",
|
|
SchemaName: "is_marked_as_unread",
|
|
},
|
|
{
|
|
Name: "ViewAsTopics",
|
|
SchemaName: "view_as_topics",
|
|
},
|
|
{
|
|
Name: "HasScheduledMessages",
|
|
SchemaName: "has_scheduled_messages",
|
|
},
|
|
{
|
|
Name: "CanBeDeletedOnlyForSelf",
|
|
SchemaName: "can_be_deleted_only_for_self",
|
|
},
|
|
{
|
|
Name: "CanBeDeletedForAllUsers",
|
|
SchemaName: "can_be_deleted_for_all_users",
|
|
},
|
|
{
|
|
Name: "CanBeReported",
|
|
SchemaName: "can_be_reported",
|
|
},
|
|
{
|
|
Name: "DefaultDisableNotification",
|
|
SchemaName: "default_disable_notification",
|
|
},
|
|
{
|
|
Name: "UnreadCount",
|
|
SchemaName: "unread_count",
|
|
},
|
|
{
|
|
Name: "LastReadInboxMessageID",
|
|
SchemaName: "last_read_inbox_message_id",
|
|
},
|
|
{
|
|
Name: "LastReadOutboxMessageID",
|
|
SchemaName: "last_read_outbox_message_id",
|
|
},
|
|
{
|
|
Name: "UnreadMentionCount",
|
|
SchemaName: "unread_mention_count",
|
|
},
|
|
{
|
|
Name: "UnreadReactionCount",
|
|
SchemaName: "unread_reaction_count",
|
|
},
|
|
{
|
|
Name: "NotificationSettings",
|
|
SchemaName: "notification_settings",
|
|
},
|
|
{
|
|
Name: "AvailableReactions",
|
|
SchemaName: "available_reactions",
|
|
},
|
|
{
|
|
Name: "MessageAutoDeleteTime",
|
|
SchemaName: "message_auto_delete_time",
|
|
},
|
|
{
|
|
Name: "EmojiStatus",
|
|
SchemaName: "emoji_status",
|
|
},
|
|
{
|
|
Name: "Background",
|
|
SchemaName: "background",
|
|
},
|
|
{
|
|
Name: "ThemeName",
|
|
SchemaName: "theme_name",
|
|
},
|
|
{
|
|
Name: "ActionBar",
|
|
SchemaName: "action_bar",
|
|
},
|
|
{
|
|
Name: "BusinessBotManageBar",
|
|
SchemaName: "business_bot_manage_bar",
|
|
},
|
|
{
|
|
Name: "VideoChat",
|
|
SchemaName: "video_chat",
|
|
},
|
|
{
|
|
Name: "PendingJoinRequests",
|
|
SchemaName: "pending_join_requests",
|
|
},
|
|
{
|
|
Name: "ReplyMarkupMessageID",
|
|
SchemaName: "reply_markup_message_id",
|
|
},
|
|
{
|
|
Name: "DraftMessage",
|
|
SchemaName: "draft_message",
|
|
},
|
|
{
|
|
Name: "ClientData",
|
|
SchemaName: "client_data",
|
|
},
|
|
}
|
|
return typ
|
|
}
|
|
|
|
// Encode implements bin.Encoder.
|
|
func (c *Chat) Encode(b *bin.Buffer) error {
|
|
if c == nil {
|
|
return fmt.Errorf("can't encode chat#e5bae2e4 as nil")
|
|
}
|
|
b.PutID(ChatTypeID)
|
|
return c.EncodeBare(b)
|
|
}
|
|
|
|
// EncodeBare implements bin.BareEncoder.
|
|
func (c *Chat) EncodeBare(b *bin.Buffer) error {
|
|
if c == nil {
|
|
return fmt.Errorf("can't encode chat#e5bae2e4 as nil")
|
|
}
|
|
b.PutInt53(c.ID)
|
|
if c.Type == nil {
|
|
return fmt.Errorf("unable to encode chat#e5bae2e4: field type is nil")
|
|
}
|
|
if err := c.Type.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode chat#e5bae2e4: field type: %w", err)
|
|
}
|
|
b.PutString(c.Title)
|
|
if err := c.Photo.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode chat#e5bae2e4: field photo: %w", err)
|
|
}
|
|
b.PutInt32(c.AccentColorID)
|
|
b.PutLong(c.BackgroundCustomEmojiID)
|
|
b.PutInt32(c.ProfileAccentColorID)
|
|
b.PutLong(c.ProfileBackgroundCustomEmojiID)
|
|
if err := c.Permissions.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode chat#e5bae2e4: field permissions: %w", err)
|
|
}
|
|
if err := c.LastMessage.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode chat#e5bae2e4: field last_message: %w", err)
|
|
}
|
|
b.PutInt(len(c.Positions))
|
|
for idx, v := range c.Positions {
|
|
if err := v.EncodeBare(b); err != nil {
|
|
return fmt.Errorf("unable to encode bare chat#e5bae2e4: field positions element with index %d: %w", idx, err)
|
|
}
|
|
}
|
|
b.PutInt(len(c.ChatLists))
|
|
for idx, v := range c.ChatLists {
|
|
if v == nil {
|
|
return fmt.Errorf("unable to encode chat#e5bae2e4: field chat_lists element with index %d is nil", idx)
|
|
}
|
|
if err := v.EncodeBare(b); err != nil {
|
|
return fmt.Errorf("unable to encode bare chat#e5bae2e4: field chat_lists element with index %d: %w", idx, err)
|
|
}
|
|
}
|
|
if c.MessageSenderID == nil {
|
|
return fmt.Errorf("unable to encode chat#e5bae2e4: field message_sender_id is nil")
|
|
}
|
|
if err := c.MessageSenderID.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode chat#e5bae2e4: field message_sender_id: %w", err)
|
|
}
|
|
if c.BlockList == nil {
|
|
return fmt.Errorf("unable to encode chat#e5bae2e4: field block_list is nil")
|
|
}
|
|
if err := c.BlockList.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode chat#e5bae2e4: field block_list: %w", err)
|
|
}
|
|
b.PutBool(c.HasProtectedContent)
|
|
b.PutBool(c.IsTranslatable)
|
|
b.PutBool(c.IsMarkedAsUnread)
|
|
b.PutBool(c.ViewAsTopics)
|
|
b.PutBool(c.HasScheduledMessages)
|
|
b.PutBool(c.CanBeDeletedOnlyForSelf)
|
|
b.PutBool(c.CanBeDeletedForAllUsers)
|
|
b.PutBool(c.CanBeReported)
|
|
b.PutBool(c.DefaultDisableNotification)
|
|
b.PutInt32(c.UnreadCount)
|
|
b.PutInt53(c.LastReadInboxMessageID)
|
|
b.PutInt53(c.LastReadOutboxMessageID)
|
|
b.PutInt32(c.UnreadMentionCount)
|
|
b.PutInt32(c.UnreadReactionCount)
|
|
if err := c.NotificationSettings.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode chat#e5bae2e4: field notification_settings: %w", err)
|
|
}
|
|
if c.AvailableReactions == nil {
|
|
return fmt.Errorf("unable to encode chat#e5bae2e4: field available_reactions is nil")
|
|
}
|
|
if err := c.AvailableReactions.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode chat#e5bae2e4: field available_reactions: %w", err)
|
|
}
|
|
b.PutInt32(c.MessageAutoDeleteTime)
|
|
if err := c.EmojiStatus.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode chat#e5bae2e4: field emoji_status: %w", err)
|
|
}
|
|
if err := c.Background.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode chat#e5bae2e4: field background: %w", err)
|
|
}
|
|
b.PutString(c.ThemeName)
|
|
if c.ActionBar == nil {
|
|
return fmt.Errorf("unable to encode chat#e5bae2e4: field action_bar is nil")
|
|
}
|
|
if err := c.ActionBar.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode chat#e5bae2e4: field action_bar: %w", err)
|
|
}
|
|
if err := c.BusinessBotManageBar.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode chat#e5bae2e4: field business_bot_manage_bar: %w", err)
|
|
}
|
|
if err := c.VideoChat.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode chat#e5bae2e4: field video_chat: %w", err)
|
|
}
|
|
if err := c.PendingJoinRequests.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode chat#e5bae2e4: field pending_join_requests: %w", err)
|
|
}
|
|
b.PutInt53(c.ReplyMarkupMessageID)
|
|
if err := c.DraftMessage.Encode(b); err != nil {
|
|
return fmt.Errorf("unable to encode chat#e5bae2e4: field draft_message: %w", err)
|
|
}
|
|
b.PutString(c.ClientData)
|
|
return nil
|
|
}
|
|
|
|
// Decode implements bin.Decoder.
|
|
func (c *Chat) Decode(b *bin.Buffer) error {
|
|
if c == nil {
|
|
return fmt.Errorf("can't decode chat#e5bae2e4 to nil")
|
|
}
|
|
if err := b.ConsumeID(ChatTypeID); err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: %w", err)
|
|
}
|
|
return c.DecodeBare(b)
|
|
}
|
|
|
|
// DecodeBare implements bin.BareDecoder.
|
|
func (c *Chat) DecodeBare(b *bin.Buffer) error {
|
|
if c == nil {
|
|
return fmt.Errorf("can't decode chat#e5bae2e4 to nil")
|
|
}
|
|
{
|
|
value, err := b.Int53()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field id: %w", err)
|
|
}
|
|
c.ID = value
|
|
}
|
|
{
|
|
value, err := DecodeChatType(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field type: %w", err)
|
|
}
|
|
c.Type = value
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field title: %w", err)
|
|
}
|
|
c.Title = value
|
|
}
|
|
{
|
|
if err := c.Photo.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field photo: %w", err)
|
|
}
|
|
}
|
|
{
|
|
value, err := b.Int32()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field accent_color_id: %w", err)
|
|
}
|
|
c.AccentColorID = value
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field background_custom_emoji_id: %w", err)
|
|
}
|
|
c.BackgroundCustomEmojiID = value
|
|
}
|
|
{
|
|
value, err := b.Int32()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field profile_accent_color_id: %w", err)
|
|
}
|
|
c.ProfileAccentColorID = value
|
|
}
|
|
{
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field profile_background_custom_emoji_id: %w", err)
|
|
}
|
|
c.ProfileBackgroundCustomEmojiID = value
|
|
}
|
|
{
|
|
if err := c.Permissions.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field permissions: %w", err)
|
|
}
|
|
}
|
|
{
|
|
if err := c.LastMessage.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field last_message: %w", err)
|
|
}
|
|
}
|
|
{
|
|
headerLen, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field positions: %w", err)
|
|
}
|
|
|
|
if headerLen > 0 {
|
|
c.Positions = make([]ChatPosition, 0, headerLen%bin.PreallocateLimit)
|
|
}
|
|
for idx := 0; idx < headerLen; idx++ {
|
|
var value ChatPosition
|
|
if err := value.DecodeBare(b); err != nil {
|
|
return fmt.Errorf("unable to decode bare chat#e5bae2e4: field positions: %w", err)
|
|
}
|
|
c.Positions = append(c.Positions, value)
|
|
}
|
|
}
|
|
{
|
|
headerLen, err := b.Int()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field chat_lists: %w", err)
|
|
}
|
|
|
|
if headerLen > 0 {
|
|
c.ChatLists = make([]ChatListClass, 0, headerLen%bin.PreallocateLimit)
|
|
}
|
|
for idx := 0; idx < headerLen; idx++ {
|
|
value, err := DecodeChatList(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field chat_lists: %w", err)
|
|
}
|
|
c.ChatLists = append(c.ChatLists, value)
|
|
}
|
|
}
|
|
{
|
|
value, err := DecodeMessageSender(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field message_sender_id: %w", err)
|
|
}
|
|
c.MessageSenderID = value
|
|
}
|
|
{
|
|
value, err := DecodeBlockList(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field block_list: %w", err)
|
|
}
|
|
c.BlockList = value
|
|
}
|
|
{
|
|
value, err := b.Bool()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field has_protected_content: %w", err)
|
|
}
|
|
c.HasProtectedContent = value
|
|
}
|
|
{
|
|
value, err := b.Bool()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field is_translatable: %w", err)
|
|
}
|
|
c.IsTranslatable = value
|
|
}
|
|
{
|
|
value, err := b.Bool()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field is_marked_as_unread: %w", err)
|
|
}
|
|
c.IsMarkedAsUnread = value
|
|
}
|
|
{
|
|
value, err := b.Bool()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field view_as_topics: %w", err)
|
|
}
|
|
c.ViewAsTopics = value
|
|
}
|
|
{
|
|
value, err := b.Bool()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field has_scheduled_messages: %w", err)
|
|
}
|
|
c.HasScheduledMessages = value
|
|
}
|
|
{
|
|
value, err := b.Bool()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field can_be_deleted_only_for_self: %w", err)
|
|
}
|
|
c.CanBeDeletedOnlyForSelf = value
|
|
}
|
|
{
|
|
value, err := b.Bool()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field can_be_deleted_for_all_users: %w", err)
|
|
}
|
|
c.CanBeDeletedForAllUsers = value
|
|
}
|
|
{
|
|
value, err := b.Bool()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field can_be_reported: %w", err)
|
|
}
|
|
c.CanBeReported = value
|
|
}
|
|
{
|
|
value, err := b.Bool()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field default_disable_notification: %w", err)
|
|
}
|
|
c.DefaultDisableNotification = value
|
|
}
|
|
{
|
|
value, err := b.Int32()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field unread_count: %w", err)
|
|
}
|
|
c.UnreadCount = value
|
|
}
|
|
{
|
|
value, err := b.Int53()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field last_read_inbox_message_id: %w", err)
|
|
}
|
|
c.LastReadInboxMessageID = value
|
|
}
|
|
{
|
|
value, err := b.Int53()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field last_read_outbox_message_id: %w", err)
|
|
}
|
|
c.LastReadOutboxMessageID = value
|
|
}
|
|
{
|
|
value, err := b.Int32()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field unread_mention_count: %w", err)
|
|
}
|
|
c.UnreadMentionCount = value
|
|
}
|
|
{
|
|
value, err := b.Int32()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field unread_reaction_count: %w", err)
|
|
}
|
|
c.UnreadReactionCount = value
|
|
}
|
|
{
|
|
if err := c.NotificationSettings.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field notification_settings: %w", err)
|
|
}
|
|
}
|
|
{
|
|
value, err := DecodeChatAvailableReactions(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field available_reactions: %w", err)
|
|
}
|
|
c.AvailableReactions = value
|
|
}
|
|
{
|
|
value, err := b.Int32()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field message_auto_delete_time: %w", err)
|
|
}
|
|
c.MessageAutoDeleteTime = value
|
|
}
|
|
{
|
|
if err := c.EmojiStatus.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field emoji_status: %w", err)
|
|
}
|
|
}
|
|
{
|
|
if err := c.Background.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field background: %w", err)
|
|
}
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field theme_name: %w", err)
|
|
}
|
|
c.ThemeName = value
|
|
}
|
|
{
|
|
value, err := DecodeChatActionBar(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field action_bar: %w", err)
|
|
}
|
|
c.ActionBar = value
|
|
}
|
|
{
|
|
if err := c.BusinessBotManageBar.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field business_bot_manage_bar: %w", err)
|
|
}
|
|
}
|
|
{
|
|
if err := c.VideoChat.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field video_chat: %w", err)
|
|
}
|
|
}
|
|
{
|
|
if err := c.PendingJoinRequests.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field pending_join_requests: %w", err)
|
|
}
|
|
}
|
|
{
|
|
value, err := b.Int53()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field reply_markup_message_id: %w", err)
|
|
}
|
|
c.ReplyMarkupMessageID = value
|
|
}
|
|
{
|
|
if err := c.DraftMessage.Decode(b); err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field draft_message: %w", err)
|
|
}
|
|
}
|
|
{
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field client_data: %w", err)
|
|
}
|
|
c.ClientData = value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// EncodeTDLibJSON implements tdjson.TDLibEncoder.
|
|
func (c *Chat) EncodeTDLibJSON(b tdjson.Encoder) error {
|
|
if c == nil {
|
|
return fmt.Errorf("can't encode chat#e5bae2e4 as nil")
|
|
}
|
|
b.ObjStart()
|
|
b.PutID("chat")
|
|
b.Comma()
|
|
b.FieldStart("id")
|
|
b.PutInt53(c.ID)
|
|
b.Comma()
|
|
b.FieldStart("type")
|
|
if c.Type == nil {
|
|
return fmt.Errorf("unable to encode chat#e5bae2e4: field type is nil")
|
|
}
|
|
if err := c.Type.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode chat#e5bae2e4: field type: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.FieldStart("title")
|
|
b.PutString(c.Title)
|
|
b.Comma()
|
|
b.FieldStart("photo")
|
|
if err := c.Photo.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode chat#e5bae2e4: field photo: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.FieldStart("accent_color_id")
|
|
b.PutInt32(c.AccentColorID)
|
|
b.Comma()
|
|
b.FieldStart("background_custom_emoji_id")
|
|
b.PutLong(c.BackgroundCustomEmojiID)
|
|
b.Comma()
|
|
b.FieldStart("profile_accent_color_id")
|
|
b.PutInt32(c.ProfileAccentColorID)
|
|
b.Comma()
|
|
b.FieldStart("profile_background_custom_emoji_id")
|
|
b.PutLong(c.ProfileBackgroundCustomEmojiID)
|
|
b.Comma()
|
|
b.FieldStart("permissions")
|
|
if err := c.Permissions.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode chat#e5bae2e4: field permissions: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.FieldStart("last_message")
|
|
if err := c.LastMessage.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode chat#e5bae2e4: field last_message: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.FieldStart("positions")
|
|
b.ArrStart()
|
|
for idx, v := range c.Positions {
|
|
if err := v.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode chat#e5bae2e4: field positions element with index %d: %w", idx, err)
|
|
}
|
|
b.Comma()
|
|
}
|
|
b.StripComma()
|
|
b.ArrEnd()
|
|
b.Comma()
|
|
b.FieldStart("chat_lists")
|
|
b.ArrStart()
|
|
for idx, v := range c.ChatLists {
|
|
if v == nil {
|
|
return fmt.Errorf("unable to encode chat#e5bae2e4: field chat_lists element with index %d is nil", idx)
|
|
}
|
|
if err := v.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode chat#e5bae2e4: field chat_lists element with index %d: %w", idx, err)
|
|
}
|
|
b.Comma()
|
|
}
|
|
b.StripComma()
|
|
b.ArrEnd()
|
|
b.Comma()
|
|
b.FieldStart("message_sender_id")
|
|
if c.MessageSenderID == nil {
|
|
return fmt.Errorf("unable to encode chat#e5bae2e4: field message_sender_id is nil")
|
|
}
|
|
if err := c.MessageSenderID.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode chat#e5bae2e4: field message_sender_id: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.FieldStart("block_list")
|
|
if c.BlockList == nil {
|
|
return fmt.Errorf("unable to encode chat#e5bae2e4: field block_list is nil")
|
|
}
|
|
if err := c.BlockList.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode chat#e5bae2e4: field block_list: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.FieldStart("has_protected_content")
|
|
b.PutBool(c.HasProtectedContent)
|
|
b.Comma()
|
|
b.FieldStart("is_translatable")
|
|
b.PutBool(c.IsTranslatable)
|
|
b.Comma()
|
|
b.FieldStart("is_marked_as_unread")
|
|
b.PutBool(c.IsMarkedAsUnread)
|
|
b.Comma()
|
|
b.FieldStart("view_as_topics")
|
|
b.PutBool(c.ViewAsTopics)
|
|
b.Comma()
|
|
b.FieldStart("has_scheduled_messages")
|
|
b.PutBool(c.HasScheduledMessages)
|
|
b.Comma()
|
|
b.FieldStart("can_be_deleted_only_for_self")
|
|
b.PutBool(c.CanBeDeletedOnlyForSelf)
|
|
b.Comma()
|
|
b.FieldStart("can_be_deleted_for_all_users")
|
|
b.PutBool(c.CanBeDeletedForAllUsers)
|
|
b.Comma()
|
|
b.FieldStart("can_be_reported")
|
|
b.PutBool(c.CanBeReported)
|
|
b.Comma()
|
|
b.FieldStart("default_disable_notification")
|
|
b.PutBool(c.DefaultDisableNotification)
|
|
b.Comma()
|
|
b.FieldStart("unread_count")
|
|
b.PutInt32(c.UnreadCount)
|
|
b.Comma()
|
|
b.FieldStart("last_read_inbox_message_id")
|
|
b.PutInt53(c.LastReadInboxMessageID)
|
|
b.Comma()
|
|
b.FieldStart("last_read_outbox_message_id")
|
|
b.PutInt53(c.LastReadOutboxMessageID)
|
|
b.Comma()
|
|
b.FieldStart("unread_mention_count")
|
|
b.PutInt32(c.UnreadMentionCount)
|
|
b.Comma()
|
|
b.FieldStart("unread_reaction_count")
|
|
b.PutInt32(c.UnreadReactionCount)
|
|
b.Comma()
|
|
b.FieldStart("notification_settings")
|
|
if err := c.NotificationSettings.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode chat#e5bae2e4: field notification_settings: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.FieldStart("available_reactions")
|
|
if c.AvailableReactions == nil {
|
|
return fmt.Errorf("unable to encode chat#e5bae2e4: field available_reactions is nil")
|
|
}
|
|
if err := c.AvailableReactions.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode chat#e5bae2e4: field available_reactions: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.FieldStart("message_auto_delete_time")
|
|
b.PutInt32(c.MessageAutoDeleteTime)
|
|
b.Comma()
|
|
b.FieldStart("emoji_status")
|
|
if err := c.EmojiStatus.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode chat#e5bae2e4: field emoji_status: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.FieldStart("background")
|
|
if err := c.Background.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode chat#e5bae2e4: field background: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.FieldStart("theme_name")
|
|
b.PutString(c.ThemeName)
|
|
b.Comma()
|
|
b.FieldStart("action_bar")
|
|
if c.ActionBar == nil {
|
|
return fmt.Errorf("unable to encode chat#e5bae2e4: field action_bar is nil")
|
|
}
|
|
if err := c.ActionBar.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode chat#e5bae2e4: field action_bar: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.FieldStart("business_bot_manage_bar")
|
|
if err := c.BusinessBotManageBar.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode chat#e5bae2e4: field business_bot_manage_bar: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.FieldStart("video_chat")
|
|
if err := c.VideoChat.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode chat#e5bae2e4: field video_chat: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.FieldStart("pending_join_requests")
|
|
if err := c.PendingJoinRequests.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode chat#e5bae2e4: field pending_join_requests: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.FieldStart("reply_markup_message_id")
|
|
b.PutInt53(c.ReplyMarkupMessageID)
|
|
b.Comma()
|
|
b.FieldStart("draft_message")
|
|
if err := c.DraftMessage.EncodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to encode chat#e5bae2e4: field draft_message: %w", err)
|
|
}
|
|
b.Comma()
|
|
b.FieldStart("client_data")
|
|
b.PutString(c.ClientData)
|
|
b.Comma()
|
|
b.StripComma()
|
|
b.ObjEnd()
|
|
return nil
|
|
}
|
|
|
|
// DecodeTDLibJSON implements tdjson.TDLibDecoder.
|
|
func (c *Chat) DecodeTDLibJSON(b tdjson.Decoder) error {
|
|
if c == nil {
|
|
return fmt.Errorf("can't decode chat#e5bae2e4 to nil")
|
|
}
|
|
|
|
return b.Obj(func(b tdjson.Decoder, key []byte) error {
|
|
switch string(key) {
|
|
case tdjson.TypeField:
|
|
if err := b.ConsumeID("chat"); err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: %w", err)
|
|
}
|
|
case "id":
|
|
value, err := b.Int53()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field id: %w", err)
|
|
}
|
|
c.ID = value
|
|
case "type":
|
|
value, err := DecodeTDLibJSONChatType(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field type: %w", err)
|
|
}
|
|
c.Type = value
|
|
case "title":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field title: %w", err)
|
|
}
|
|
c.Title = value
|
|
case "photo":
|
|
if err := c.Photo.DecodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field photo: %w", err)
|
|
}
|
|
case "accent_color_id":
|
|
value, err := b.Int32()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field accent_color_id: %w", err)
|
|
}
|
|
c.AccentColorID = value
|
|
case "background_custom_emoji_id":
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field background_custom_emoji_id: %w", err)
|
|
}
|
|
c.BackgroundCustomEmojiID = value
|
|
case "profile_accent_color_id":
|
|
value, err := b.Int32()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field profile_accent_color_id: %w", err)
|
|
}
|
|
c.ProfileAccentColorID = value
|
|
case "profile_background_custom_emoji_id":
|
|
value, err := b.Long()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field profile_background_custom_emoji_id: %w", err)
|
|
}
|
|
c.ProfileBackgroundCustomEmojiID = value
|
|
case "permissions":
|
|
if err := c.Permissions.DecodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field permissions: %w", err)
|
|
}
|
|
case "last_message":
|
|
if err := c.LastMessage.DecodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field last_message: %w", err)
|
|
}
|
|
case "positions":
|
|
if err := b.Arr(func(b tdjson.Decoder) error {
|
|
var value ChatPosition
|
|
if err := value.DecodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field positions: %w", err)
|
|
}
|
|
c.Positions = append(c.Positions, value)
|
|
return nil
|
|
}); err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field positions: %w", err)
|
|
}
|
|
case "chat_lists":
|
|
if err := b.Arr(func(b tdjson.Decoder) error {
|
|
value, err := DecodeTDLibJSONChatList(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field chat_lists: %w", err)
|
|
}
|
|
c.ChatLists = append(c.ChatLists, value)
|
|
return nil
|
|
}); err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field chat_lists: %w", err)
|
|
}
|
|
case "message_sender_id":
|
|
value, err := DecodeTDLibJSONMessageSender(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field message_sender_id: %w", err)
|
|
}
|
|
c.MessageSenderID = value
|
|
case "block_list":
|
|
value, err := DecodeTDLibJSONBlockList(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field block_list: %w", err)
|
|
}
|
|
c.BlockList = value
|
|
case "has_protected_content":
|
|
value, err := b.Bool()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field has_protected_content: %w", err)
|
|
}
|
|
c.HasProtectedContent = value
|
|
case "is_translatable":
|
|
value, err := b.Bool()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field is_translatable: %w", err)
|
|
}
|
|
c.IsTranslatable = value
|
|
case "is_marked_as_unread":
|
|
value, err := b.Bool()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field is_marked_as_unread: %w", err)
|
|
}
|
|
c.IsMarkedAsUnread = value
|
|
case "view_as_topics":
|
|
value, err := b.Bool()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field view_as_topics: %w", err)
|
|
}
|
|
c.ViewAsTopics = value
|
|
case "has_scheduled_messages":
|
|
value, err := b.Bool()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field has_scheduled_messages: %w", err)
|
|
}
|
|
c.HasScheduledMessages = value
|
|
case "can_be_deleted_only_for_self":
|
|
value, err := b.Bool()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field can_be_deleted_only_for_self: %w", err)
|
|
}
|
|
c.CanBeDeletedOnlyForSelf = value
|
|
case "can_be_deleted_for_all_users":
|
|
value, err := b.Bool()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field can_be_deleted_for_all_users: %w", err)
|
|
}
|
|
c.CanBeDeletedForAllUsers = value
|
|
case "can_be_reported":
|
|
value, err := b.Bool()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field can_be_reported: %w", err)
|
|
}
|
|
c.CanBeReported = value
|
|
case "default_disable_notification":
|
|
value, err := b.Bool()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field default_disable_notification: %w", err)
|
|
}
|
|
c.DefaultDisableNotification = value
|
|
case "unread_count":
|
|
value, err := b.Int32()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field unread_count: %w", err)
|
|
}
|
|
c.UnreadCount = value
|
|
case "last_read_inbox_message_id":
|
|
value, err := b.Int53()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field last_read_inbox_message_id: %w", err)
|
|
}
|
|
c.LastReadInboxMessageID = value
|
|
case "last_read_outbox_message_id":
|
|
value, err := b.Int53()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field last_read_outbox_message_id: %w", err)
|
|
}
|
|
c.LastReadOutboxMessageID = value
|
|
case "unread_mention_count":
|
|
value, err := b.Int32()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field unread_mention_count: %w", err)
|
|
}
|
|
c.UnreadMentionCount = value
|
|
case "unread_reaction_count":
|
|
value, err := b.Int32()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field unread_reaction_count: %w", err)
|
|
}
|
|
c.UnreadReactionCount = value
|
|
case "notification_settings":
|
|
if err := c.NotificationSettings.DecodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field notification_settings: %w", err)
|
|
}
|
|
case "available_reactions":
|
|
value, err := DecodeTDLibJSONChatAvailableReactions(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field available_reactions: %w", err)
|
|
}
|
|
c.AvailableReactions = value
|
|
case "message_auto_delete_time":
|
|
value, err := b.Int32()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field message_auto_delete_time: %w", err)
|
|
}
|
|
c.MessageAutoDeleteTime = value
|
|
case "emoji_status":
|
|
if err := c.EmojiStatus.DecodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field emoji_status: %w", err)
|
|
}
|
|
case "background":
|
|
if err := c.Background.DecodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field background: %w", err)
|
|
}
|
|
case "theme_name":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field theme_name: %w", err)
|
|
}
|
|
c.ThemeName = value
|
|
case "action_bar":
|
|
value, err := DecodeTDLibJSONChatActionBar(b)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field action_bar: %w", err)
|
|
}
|
|
c.ActionBar = value
|
|
case "business_bot_manage_bar":
|
|
if err := c.BusinessBotManageBar.DecodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field business_bot_manage_bar: %w", err)
|
|
}
|
|
case "video_chat":
|
|
if err := c.VideoChat.DecodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field video_chat: %w", err)
|
|
}
|
|
case "pending_join_requests":
|
|
if err := c.PendingJoinRequests.DecodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field pending_join_requests: %w", err)
|
|
}
|
|
case "reply_markup_message_id":
|
|
value, err := b.Int53()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field reply_markup_message_id: %w", err)
|
|
}
|
|
c.ReplyMarkupMessageID = value
|
|
case "draft_message":
|
|
if err := c.DraftMessage.DecodeTDLibJSON(b); err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field draft_message: %w", err)
|
|
}
|
|
case "client_data":
|
|
value, err := b.String()
|
|
if err != nil {
|
|
return fmt.Errorf("unable to decode chat#e5bae2e4: field client_data: %w", err)
|
|
}
|
|
c.ClientData = value
|
|
default:
|
|
return b.Skip()
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// GetID returns value of ID field.
|
|
func (c *Chat) GetID() (value int64) {
|
|
if c == nil {
|
|
return
|
|
}
|
|
return c.ID
|
|
}
|
|
|
|
// GetType returns value of Type field.
|
|
func (c *Chat) GetType() (value ChatTypeClass) {
|
|
if c == nil {
|
|
return
|
|
}
|
|
return c.Type
|
|
}
|
|
|
|
// GetTitle returns value of Title field.
|
|
func (c *Chat) GetTitle() (value string) {
|
|
if c == nil {
|
|
return
|
|
}
|
|
return c.Title
|
|
}
|
|
|
|
// GetPhoto returns value of Photo field.
|
|
func (c *Chat) GetPhoto() (value ChatPhotoInfo) {
|
|
if c == nil {
|
|
return
|
|
}
|
|
return c.Photo
|
|
}
|
|
|
|
// GetAccentColorID returns value of AccentColorID field.
|
|
func (c *Chat) GetAccentColorID() (value int32) {
|
|
if c == nil {
|
|
return
|
|
}
|
|
return c.AccentColorID
|
|
}
|
|
|
|
// GetBackgroundCustomEmojiID returns value of BackgroundCustomEmojiID field.
|
|
func (c *Chat) GetBackgroundCustomEmojiID() (value int64) {
|
|
if c == nil {
|
|
return
|
|
}
|
|
return c.BackgroundCustomEmojiID
|
|
}
|
|
|
|
// GetProfileAccentColorID returns value of ProfileAccentColorID field.
|
|
func (c *Chat) GetProfileAccentColorID() (value int32) {
|
|
if c == nil {
|
|
return
|
|
}
|
|
return c.ProfileAccentColorID
|
|
}
|
|
|
|
// GetProfileBackgroundCustomEmojiID returns value of ProfileBackgroundCustomEmojiID field.
|
|
func (c *Chat) GetProfileBackgroundCustomEmojiID() (value int64) {
|
|
if c == nil {
|
|
return
|
|
}
|
|
return c.ProfileBackgroundCustomEmojiID
|
|
}
|
|
|
|
// GetPermissions returns value of Permissions field.
|
|
func (c *Chat) GetPermissions() (value ChatPermissions) {
|
|
if c == nil {
|
|
return
|
|
}
|
|
return c.Permissions
|
|
}
|
|
|
|
// GetLastMessage returns value of LastMessage field.
|
|
func (c *Chat) GetLastMessage() (value Message) {
|
|
if c == nil {
|
|
return
|
|
}
|
|
return c.LastMessage
|
|
}
|
|
|
|
// GetPositions returns value of Positions field.
|
|
func (c *Chat) GetPositions() (value []ChatPosition) {
|
|
if c == nil {
|
|
return
|
|
}
|
|
return c.Positions
|
|
}
|
|
|
|
// GetChatLists returns value of ChatLists field.
|
|
func (c *Chat) GetChatLists() (value []ChatListClass) {
|
|
if c == nil {
|
|
return
|
|
}
|
|
return c.ChatLists
|
|
}
|
|
|
|
// GetMessageSenderID returns value of MessageSenderID field.
|
|
func (c *Chat) GetMessageSenderID() (value MessageSenderClass) {
|
|
if c == nil {
|
|
return
|
|
}
|
|
return c.MessageSenderID
|
|
}
|
|
|
|
// GetBlockList returns value of BlockList field.
|
|
func (c *Chat) GetBlockList() (value BlockListClass) {
|
|
if c == nil {
|
|
return
|
|
}
|
|
return c.BlockList
|
|
}
|
|
|
|
// GetHasProtectedContent returns value of HasProtectedContent field.
|
|
func (c *Chat) GetHasProtectedContent() (value bool) {
|
|
if c == nil {
|
|
return
|
|
}
|
|
return c.HasProtectedContent
|
|
}
|
|
|
|
// GetIsTranslatable returns value of IsTranslatable field.
|
|
func (c *Chat) GetIsTranslatable() (value bool) {
|
|
if c == nil {
|
|
return
|
|
}
|
|
return c.IsTranslatable
|
|
}
|
|
|
|
// GetIsMarkedAsUnread returns value of IsMarkedAsUnread field.
|
|
func (c *Chat) GetIsMarkedAsUnread() (value bool) {
|
|
if c == nil {
|
|
return
|
|
}
|
|
return c.IsMarkedAsUnread
|
|
}
|
|
|
|
// GetViewAsTopics returns value of ViewAsTopics field.
|
|
func (c *Chat) GetViewAsTopics() (value bool) {
|
|
if c == nil {
|
|
return
|
|
}
|
|
return c.ViewAsTopics
|
|
}
|
|
|
|
// GetHasScheduledMessages returns value of HasScheduledMessages field.
|
|
func (c *Chat) GetHasScheduledMessages() (value bool) {
|
|
if c == nil {
|
|
return
|
|
}
|
|
return c.HasScheduledMessages
|
|
}
|
|
|
|
// GetCanBeDeletedOnlyForSelf returns value of CanBeDeletedOnlyForSelf field.
|
|
func (c *Chat) GetCanBeDeletedOnlyForSelf() (value bool) {
|
|
if c == nil {
|
|
return
|
|
}
|
|
return c.CanBeDeletedOnlyForSelf
|
|
}
|
|
|
|
// GetCanBeDeletedForAllUsers returns value of CanBeDeletedForAllUsers field.
|
|
func (c *Chat) GetCanBeDeletedForAllUsers() (value bool) {
|
|
if c == nil {
|
|
return
|
|
}
|
|
return c.CanBeDeletedForAllUsers
|
|
}
|
|
|
|
// GetCanBeReported returns value of CanBeReported field.
|
|
func (c *Chat) GetCanBeReported() (value bool) {
|
|
if c == nil {
|
|
return
|
|
}
|
|
return c.CanBeReported
|
|
}
|
|
|
|
// GetDefaultDisableNotification returns value of DefaultDisableNotification field.
|
|
func (c *Chat) GetDefaultDisableNotification() (value bool) {
|
|
if c == nil {
|
|
return
|
|
}
|
|
return c.DefaultDisableNotification
|
|
}
|
|
|
|
// GetUnreadCount returns value of UnreadCount field.
|
|
func (c *Chat) GetUnreadCount() (value int32) {
|
|
if c == nil {
|
|
return
|
|
}
|
|
return c.UnreadCount
|
|
}
|
|
|
|
// GetLastReadInboxMessageID returns value of LastReadInboxMessageID field.
|
|
func (c *Chat) GetLastReadInboxMessageID() (value int64) {
|
|
if c == nil {
|
|
return
|
|
}
|
|
return c.LastReadInboxMessageID
|
|
}
|
|
|
|
// GetLastReadOutboxMessageID returns value of LastReadOutboxMessageID field.
|
|
func (c *Chat) GetLastReadOutboxMessageID() (value int64) {
|
|
if c == nil {
|
|
return
|
|
}
|
|
return c.LastReadOutboxMessageID
|
|
}
|
|
|
|
// GetUnreadMentionCount returns value of UnreadMentionCount field.
|
|
func (c *Chat) GetUnreadMentionCount() (value int32) {
|
|
if c == nil {
|
|
return
|
|
}
|
|
return c.UnreadMentionCount
|
|
}
|
|
|
|
// GetUnreadReactionCount returns value of UnreadReactionCount field.
|
|
func (c *Chat) GetUnreadReactionCount() (value int32) {
|
|
if c == nil {
|
|
return
|
|
}
|
|
return c.UnreadReactionCount
|
|
}
|
|
|
|
// GetNotificationSettings returns value of NotificationSettings field.
|
|
func (c *Chat) GetNotificationSettings() (value ChatNotificationSettings) {
|
|
if c == nil {
|
|
return
|
|
}
|
|
return c.NotificationSettings
|
|
}
|
|
|
|
// GetAvailableReactions returns value of AvailableReactions field.
|
|
func (c *Chat) GetAvailableReactions() (value ChatAvailableReactionsClass) {
|
|
if c == nil {
|
|
return
|
|
}
|
|
return c.AvailableReactions
|
|
}
|
|
|
|
// GetMessageAutoDeleteTime returns value of MessageAutoDeleteTime field.
|
|
func (c *Chat) GetMessageAutoDeleteTime() (value int32) {
|
|
if c == nil {
|
|
return
|
|
}
|
|
return c.MessageAutoDeleteTime
|
|
}
|
|
|
|
// GetEmojiStatus returns value of EmojiStatus field.
|
|
func (c *Chat) GetEmojiStatus() (value EmojiStatus) {
|
|
if c == nil {
|
|
return
|
|
}
|
|
return c.EmojiStatus
|
|
}
|
|
|
|
// GetBackground returns value of Background field.
|
|
func (c *Chat) GetBackground() (value ChatBackground) {
|
|
if c == nil {
|
|
return
|
|
}
|
|
return c.Background
|
|
}
|
|
|
|
// GetThemeName returns value of ThemeName field.
|
|
func (c *Chat) GetThemeName() (value string) {
|
|
if c == nil {
|
|
return
|
|
}
|
|
return c.ThemeName
|
|
}
|
|
|
|
// GetActionBar returns value of ActionBar field.
|
|
func (c *Chat) GetActionBar() (value ChatActionBarClass) {
|
|
if c == nil {
|
|
return
|
|
}
|
|
return c.ActionBar
|
|
}
|
|
|
|
// GetBusinessBotManageBar returns value of BusinessBotManageBar field.
|
|
func (c *Chat) GetBusinessBotManageBar() (value BusinessBotManageBar) {
|
|
if c == nil {
|
|
return
|
|
}
|
|
return c.BusinessBotManageBar
|
|
}
|
|
|
|
// GetVideoChat returns value of VideoChat field.
|
|
func (c *Chat) GetVideoChat() (value VideoChat) {
|
|
if c == nil {
|
|
return
|
|
}
|
|
return c.VideoChat
|
|
}
|
|
|
|
// GetPendingJoinRequests returns value of PendingJoinRequests field.
|
|
func (c *Chat) GetPendingJoinRequests() (value ChatJoinRequestsInfo) {
|
|
if c == nil {
|
|
return
|
|
}
|
|
return c.PendingJoinRequests
|
|
}
|
|
|
|
// GetReplyMarkupMessageID returns value of ReplyMarkupMessageID field.
|
|
func (c *Chat) GetReplyMarkupMessageID() (value int64) {
|
|
if c == nil {
|
|
return
|
|
}
|
|
return c.ReplyMarkupMessageID
|
|
}
|
|
|
|
// GetDraftMessage returns value of DraftMessage field.
|
|
func (c *Chat) GetDraftMessage() (value DraftMessage) {
|
|
if c == nil {
|
|
return
|
|
}
|
|
return c.DraftMessage
|
|
}
|
|
|
|
// GetClientData returns value of ClientData field.
|
|
func (c *Chat) GetClientData() (value string) {
|
|
if c == nil {
|
|
return
|
|
}
|
|
return c.ClientData
|
|
}
|