// 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{} ) // SupergroupFullInfo represents TL type `supergroupFullInfo#e57155ce`. type SupergroupFullInfo struct { // Chat photo; may be null if empty or unknown. If non-null, then it is the same photo as // in chat.photo Photo ChatPhoto // Contains full information about a supergroup or channel Description string // Number of members in the supergroup or channel; 0 if unknown MemberCount int32 // Number of privileged users in the supergroup or channel; 0 if unknown AdministratorCount int32 // Number of restricted users in the supergroup; 0 if unknown RestrictedCount int32 // Number of users banned from chat; 0 if unknown BannedCount int32 // Chat identifier of a discussion group for the channel, or a channel, for which the // supergroup is the designated discussion group; 0 if none or unknown LinkedChatID int64 // Chat identifier of a direct messages group for the channel, or a channel, for which // the supergroup is the designated direct messages group; 0 if none DirectMessagesChatID int64 // Delay between consecutive sent messages for non-administrator supergroup members, in // seconds SlowModeDelay int32 // Time left before next message can be sent in the supergroup, in seconds. An // updateSupergroupFullInfo update is not triggered when value of this field changes, but // both new and old values are non-zero SlowModeDelayExpiresIn float64 // True, if paid messages can be enabled in the supergroup chat; for supergroup only CanEnablePaidMessages bool // True, if paid reaction can be enabled in the channel chat; for channels only CanEnablePaidReaction bool // True, if members of the chat can be retrieved via getSupergroupMembers or // searchChatMembers CanGetMembers bool // True, if non-administrators can receive only administrators and bots using // getSupergroupMembers or searchChatMembers HasHiddenMembers bool // True, if non-administrators and non-bots can be hidden in responses to // getSupergroupMembers and searchChatMembers for non-administrators CanHideMembers bool // True, if the supergroup sticker set can be changed CanSetStickerSet bool // True, if the supergroup location can be changed CanSetLocation bool // True, if the supergroup or channel statistics are available CanGetStatistics bool // True, if the supergroup or channel revenue statistics are available CanGetRevenueStatistics bool // True, if the supergroup or channel Telegram Star revenue statistics are available CanGetStarRevenueStatistics bool // True, if the user can send a gift to the supergroup or channel using sendGift or // transferGift CanSendGift bool // True, if aggressive anti-spam checks can be enabled or disabled in the supergroup CanToggleAggressiveAntiSpam bool // True, if new chat members will have access to old messages. In public, discussion, of // forum groups and all channels, old messages are always available, IsAllHistoryAvailable bool // True, if the chat can have sponsored messages. The value of this field is only // available to the owner of the chat CanHaveSponsoredMessages bool // True, if aggressive anti-spam checks are enabled in the supergroup. The value of this // field is only available to chat administrators HasAggressiveAntiSpamEnabled bool // True, if paid media can be sent and forwarded to the channel chat; for channels only HasPaidMediaAllowed bool // True, if the supergroup or channel has pinned stories HasPinnedStories bool // Number of saved to profile gifts for channels without can_post_messages administrator // right, otherwise, the total number of received gifts GiftCount int32 // Number of times the current user boosted the supergroup or channel MyBoostCount int32 // Number of times the supergroup must be boosted by a user to ignore slow mode and chat // permission restrictions; 0 if unspecified UnrestrictBoostCount int32 // Identifier of the supergroup sticker set that must be shown before user sticker sets; // 0 if none StickerSetID int64 // Identifier of the custom emoji sticker set that can be used in the supergroup without // Telegram Premium subscription; 0 if none CustomEmojiStickerSetID int64 // Location to which the supergroup is connected; may be null if none Location ChatLocation // Primary invite link for the chat; may be null. For chat administrators with // can_invite_users right only InviteLink ChatInviteLink // List of commands of bots in the group BotCommands []BotCommands // Information about verification status of the supergroup or the channel provided by a // bot; may be null if none or unknown BotVerification BotVerification // Identifier of the basic group from which supergroup was upgraded; 0 if none UpgradedFromBasicGroupID int64 // Identifier of the last message in the basic group from which supergroup was upgraded; // 0 if none UpgradedFromMaxMessageID int64 } // SupergroupFullInfoTypeID is TL type id of SupergroupFullInfo. const SupergroupFullInfoTypeID = 0xe57155ce // Ensuring interfaces in compile-time for SupergroupFullInfo. var ( _ bin.Encoder = &SupergroupFullInfo{} _ bin.Decoder = &SupergroupFullInfo{} _ bin.BareEncoder = &SupergroupFullInfo{} _ bin.BareDecoder = &SupergroupFullInfo{} ) func (s *SupergroupFullInfo) Zero() bool { if s == nil { return true } if !(s.Photo.Zero()) { return false } if !(s.Description == "") { return false } if !(s.MemberCount == 0) { return false } if !(s.AdministratorCount == 0) { return false } if !(s.RestrictedCount == 0) { return false } if !(s.BannedCount == 0) { return false } if !(s.LinkedChatID == 0) { return false } if !(s.DirectMessagesChatID == 0) { return false } if !(s.SlowModeDelay == 0) { return false } if !(s.SlowModeDelayExpiresIn == 0) { return false } if !(s.CanEnablePaidMessages == false) { return false } if !(s.CanEnablePaidReaction == false) { return false } if !(s.CanGetMembers == false) { return false } if !(s.HasHiddenMembers == false) { return false } if !(s.CanHideMembers == false) { return false } if !(s.CanSetStickerSet == false) { return false } if !(s.CanSetLocation == false) { return false } if !(s.CanGetStatistics == false) { return false } if !(s.CanGetRevenueStatistics == false) { return false } if !(s.CanGetStarRevenueStatistics == false) { return false } if !(s.CanSendGift == false) { return false } if !(s.CanToggleAggressiveAntiSpam == false) { return false } if !(s.IsAllHistoryAvailable == false) { return false } if !(s.CanHaveSponsoredMessages == false) { return false } if !(s.HasAggressiveAntiSpamEnabled == false) { return false } if !(s.HasPaidMediaAllowed == false) { return false } if !(s.HasPinnedStories == false) { return false } if !(s.GiftCount == 0) { return false } if !(s.MyBoostCount == 0) { return false } if !(s.UnrestrictBoostCount == 0) { return false } if !(s.StickerSetID == 0) { return false } if !(s.CustomEmojiStickerSetID == 0) { return false } if !(s.Location.Zero()) { return false } if !(s.InviteLink.Zero()) { return false } if !(s.BotCommands == nil) { return false } if !(s.BotVerification.Zero()) { return false } if !(s.UpgradedFromBasicGroupID == 0) { return false } if !(s.UpgradedFromMaxMessageID == 0) { return false } return true } // String implements fmt.Stringer. func (s *SupergroupFullInfo) String() string { if s == nil { return "SupergroupFullInfo(nil)" } type Alias SupergroupFullInfo return fmt.Sprintf("SupergroupFullInfo%+v", Alias(*s)) } // TypeID returns type id in TL schema. // // See https://core.telegram.org/mtproto/TL-tl#remarks. func (*SupergroupFullInfo) TypeID() uint32 { return SupergroupFullInfoTypeID } // TypeName returns name of type in TL schema. func (*SupergroupFullInfo) TypeName() string { return "supergroupFullInfo" } // TypeInfo returns info about TL type. func (s *SupergroupFullInfo) TypeInfo() tdp.Type { typ := tdp.Type{ Name: "supergroupFullInfo", ID: SupergroupFullInfoTypeID, } if s == nil { typ.Null = true return typ } typ.Fields = []tdp.Field{ { Name: "Photo", SchemaName: "photo", }, { Name: "Description", SchemaName: "description", }, { Name: "MemberCount", SchemaName: "member_count", }, { Name: "AdministratorCount", SchemaName: "administrator_count", }, { Name: "RestrictedCount", SchemaName: "restricted_count", }, { Name: "BannedCount", SchemaName: "banned_count", }, { Name: "LinkedChatID", SchemaName: "linked_chat_id", }, { Name: "DirectMessagesChatID", SchemaName: "direct_messages_chat_id", }, { Name: "SlowModeDelay", SchemaName: "slow_mode_delay", }, { Name: "SlowModeDelayExpiresIn", SchemaName: "slow_mode_delay_expires_in", }, { Name: "CanEnablePaidMessages", SchemaName: "can_enable_paid_messages", }, { Name: "CanEnablePaidReaction", SchemaName: "can_enable_paid_reaction", }, { Name: "CanGetMembers", SchemaName: "can_get_members", }, { Name: "HasHiddenMembers", SchemaName: "has_hidden_members", }, { Name: "CanHideMembers", SchemaName: "can_hide_members", }, { Name: "CanSetStickerSet", SchemaName: "can_set_sticker_set", }, { Name: "CanSetLocation", SchemaName: "can_set_location", }, { Name: "CanGetStatistics", SchemaName: "can_get_statistics", }, { Name: "CanGetRevenueStatistics", SchemaName: "can_get_revenue_statistics", }, { Name: "CanGetStarRevenueStatistics", SchemaName: "can_get_star_revenue_statistics", }, { Name: "CanSendGift", SchemaName: "can_send_gift", }, { Name: "CanToggleAggressiveAntiSpam", SchemaName: "can_toggle_aggressive_anti_spam", }, { Name: "IsAllHistoryAvailable", SchemaName: "is_all_history_available", }, { Name: "CanHaveSponsoredMessages", SchemaName: "can_have_sponsored_messages", }, { Name: "HasAggressiveAntiSpamEnabled", SchemaName: "has_aggressive_anti_spam_enabled", }, { Name: "HasPaidMediaAllowed", SchemaName: "has_paid_media_allowed", }, { Name: "HasPinnedStories", SchemaName: "has_pinned_stories", }, { Name: "GiftCount", SchemaName: "gift_count", }, { Name: "MyBoostCount", SchemaName: "my_boost_count", }, { Name: "UnrestrictBoostCount", SchemaName: "unrestrict_boost_count", }, { Name: "StickerSetID", SchemaName: "sticker_set_id", }, { Name: "CustomEmojiStickerSetID", SchemaName: "custom_emoji_sticker_set_id", }, { Name: "Location", SchemaName: "location", }, { Name: "InviteLink", SchemaName: "invite_link", }, { Name: "BotCommands", SchemaName: "bot_commands", }, { Name: "BotVerification", SchemaName: "bot_verification", }, { Name: "UpgradedFromBasicGroupID", SchemaName: "upgraded_from_basic_group_id", }, { Name: "UpgradedFromMaxMessageID", SchemaName: "upgraded_from_max_message_id", }, } return typ } // Encode implements bin.Encoder. func (s *SupergroupFullInfo) Encode(b *bin.Buffer) error { if s == nil { return fmt.Errorf("can't encode supergroupFullInfo#e57155ce as nil") } b.PutID(SupergroupFullInfoTypeID) return s.EncodeBare(b) } // EncodeBare implements bin.BareEncoder. func (s *SupergroupFullInfo) EncodeBare(b *bin.Buffer) error { if s == nil { return fmt.Errorf("can't encode supergroupFullInfo#e57155ce as nil") } if err := s.Photo.Encode(b); err != nil { return fmt.Errorf("unable to encode supergroupFullInfo#e57155ce: field photo: %w", err) } b.PutString(s.Description) b.PutInt32(s.MemberCount) b.PutInt32(s.AdministratorCount) b.PutInt32(s.RestrictedCount) b.PutInt32(s.BannedCount) b.PutInt53(s.LinkedChatID) b.PutInt53(s.DirectMessagesChatID) b.PutInt32(s.SlowModeDelay) b.PutDouble(s.SlowModeDelayExpiresIn) b.PutBool(s.CanEnablePaidMessages) b.PutBool(s.CanEnablePaidReaction) b.PutBool(s.CanGetMembers) b.PutBool(s.HasHiddenMembers) b.PutBool(s.CanHideMembers) b.PutBool(s.CanSetStickerSet) b.PutBool(s.CanSetLocation) b.PutBool(s.CanGetStatistics) b.PutBool(s.CanGetRevenueStatistics) b.PutBool(s.CanGetStarRevenueStatistics) b.PutBool(s.CanSendGift) b.PutBool(s.CanToggleAggressiveAntiSpam) b.PutBool(s.IsAllHistoryAvailable) b.PutBool(s.CanHaveSponsoredMessages) b.PutBool(s.HasAggressiveAntiSpamEnabled) b.PutBool(s.HasPaidMediaAllowed) b.PutBool(s.HasPinnedStories) b.PutInt32(s.GiftCount) b.PutInt32(s.MyBoostCount) b.PutInt32(s.UnrestrictBoostCount) b.PutLong(s.StickerSetID) b.PutLong(s.CustomEmojiStickerSetID) if err := s.Location.Encode(b); err != nil { return fmt.Errorf("unable to encode supergroupFullInfo#e57155ce: field location: %w", err) } if err := s.InviteLink.Encode(b); err != nil { return fmt.Errorf("unable to encode supergroupFullInfo#e57155ce: field invite_link: %w", err) } b.PutInt(len(s.BotCommands)) for idx, v := range s.BotCommands { if err := v.EncodeBare(b); err != nil { return fmt.Errorf("unable to encode bare supergroupFullInfo#e57155ce: field bot_commands element with index %d: %w", idx, err) } } if err := s.BotVerification.Encode(b); err != nil { return fmt.Errorf("unable to encode supergroupFullInfo#e57155ce: field bot_verification: %w", err) } b.PutInt53(s.UpgradedFromBasicGroupID) b.PutInt53(s.UpgradedFromMaxMessageID) return nil } // Decode implements bin.Decoder. func (s *SupergroupFullInfo) Decode(b *bin.Buffer) error { if s == nil { return fmt.Errorf("can't decode supergroupFullInfo#e57155ce to nil") } if err := b.ConsumeID(SupergroupFullInfoTypeID); err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: %w", err) } return s.DecodeBare(b) } // DecodeBare implements bin.BareDecoder. func (s *SupergroupFullInfo) DecodeBare(b *bin.Buffer) error { if s == nil { return fmt.Errorf("can't decode supergroupFullInfo#e57155ce to nil") } { if err := s.Photo.Decode(b); err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: field photo: %w", err) } } { value, err := b.String() if err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: field description: %w", err) } s.Description = value } { value, err := b.Int32() if err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: field member_count: %w", err) } s.MemberCount = value } { value, err := b.Int32() if err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: field administrator_count: %w", err) } s.AdministratorCount = value } { value, err := b.Int32() if err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: field restricted_count: %w", err) } s.RestrictedCount = value } { value, err := b.Int32() if err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: field banned_count: %w", err) } s.BannedCount = value } { value, err := b.Int53() if err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: field linked_chat_id: %w", err) } s.LinkedChatID = value } { value, err := b.Int53() if err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: field direct_messages_chat_id: %w", err) } s.DirectMessagesChatID = value } { value, err := b.Int32() if err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: field slow_mode_delay: %w", err) } s.SlowModeDelay = value } { value, err := b.Double() if err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: field slow_mode_delay_expires_in: %w", err) } s.SlowModeDelayExpiresIn = value } { value, err := b.Bool() if err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: field can_enable_paid_messages: %w", err) } s.CanEnablePaidMessages = value } { value, err := b.Bool() if err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: field can_enable_paid_reaction: %w", err) } s.CanEnablePaidReaction = value } { value, err := b.Bool() if err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: field can_get_members: %w", err) } s.CanGetMembers = value } { value, err := b.Bool() if err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: field has_hidden_members: %w", err) } s.HasHiddenMembers = value } { value, err := b.Bool() if err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: field can_hide_members: %w", err) } s.CanHideMembers = value } { value, err := b.Bool() if err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: field can_set_sticker_set: %w", err) } s.CanSetStickerSet = value } { value, err := b.Bool() if err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: field can_set_location: %w", err) } s.CanSetLocation = value } { value, err := b.Bool() if err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: field can_get_statistics: %w", err) } s.CanGetStatistics = value } { value, err := b.Bool() if err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: field can_get_revenue_statistics: %w", err) } s.CanGetRevenueStatistics = value } { value, err := b.Bool() if err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: field can_get_star_revenue_statistics: %w", err) } s.CanGetStarRevenueStatistics = value } { value, err := b.Bool() if err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: field can_send_gift: %w", err) } s.CanSendGift = value } { value, err := b.Bool() if err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: field can_toggle_aggressive_anti_spam: %w", err) } s.CanToggleAggressiveAntiSpam = value } { value, err := b.Bool() if err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: field is_all_history_available: %w", err) } s.IsAllHistoryAvailable = value } { value, err := b.Bool() if err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: field can_have_sponsored_messages: %w", err) } s.CanHaveSponsoredMessages = value } { value, err := b.Bool() if err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: field has_aggressive_anti_spam_enabled: %w", err) } s.HasAggressiveAntiSpamEnabled = value } { value, err := b.Bool() if err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: field has_paid_media_allowed: %w", err) } s.HasPaidMediaAllowed = value } { value, err := b.Bool() if err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: field has_pinned_stories: %w", err) } s.HasPinnedStories = value } { value, err := b.Int32() if err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: field gift_count: %w", err) } s.GiftCount = value } { value, err := b.Int32() if err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: field my_boost_count: %w", err) } s.MyBoostCount = value } { value, err := b.Int32() if err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: field unrestrict_boost_count: %w", err) } s.UnrestrictBoostCount = value } { value, err := b.Long() if err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: field sticker_set_id: %w", err) } s.StickerSetID = value } { value, err := b.Long() if err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: field custom_emoji_sticker_set_id: %w", err) } s.CustomEmojiStickerSetID = value } { if err := s.Location.Decode(b); err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: field location: %w", err) } } { if err := s.InviteLink.Decode(b); err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: field invite_link: %w", err) } } { headerLen, err := b.Int() if err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: field bot_commands: %w", err) } if headerLen > 0 { s.BotCommands = make([]BotCommands, 0, headerLen%bin.PreallocateLimit) } for idx := 0; idx < headerLen; idx++ { var value BotCommands if err := value.DecodeBare(b); err != nil { return fmt.Errorf("unable to decode bare supergroupFullInfo#e57155ce: field bot_commands: %w", err) } s.BotCommands = append(s.BotCommands, value) } } { if err := s.BotVerification.Decode(b); err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: field bot_verification: %w", err) } } { value, err := b.Int53() if err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: field upgraded_from_basic_group_id: %w", err) } s.UpgradedFromBasicGroupID = value } { value, err := b.Int53() if err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: field upgraded_from_max_message_id: %w", err) } s.UpgradedFromMaxMessageID = value } return nil } // EncodeTDLibJSON implements tdjson.TDLibEncoder. func (s *SupergroupFullInfo) EncodeTDLibJSON(b tdjson.Encoder) error { if s == nil { return fmt.Errorf("can't encode supergroupFullInfo#e57155ce as nil") } b.ObjStart() b.PutID("supergroupFullInfo") b.Comma() b.FieldStart("photo") if err := s.Photo.EncodeTDLibJSON(b); err != nil { return fmt.Errorf("unable to encode supergroupFullInfo#e57155ce: field photo: %w", err) } b.Comma() b.FieldStart("description") b.PutString(s.Description) b.Comma() b.FieldStart("member_count") b.PutInt32(s.MemberCount) b.Comma() b.FieldStart("administrator_count") b.PutInt32(s.AdministratorCount) b.Comma() b.FieldStart("restricted_count") b.PutInt32(s.RestrictedCount) b.Comma() b.FieldStart("banned_count") b.PutInt32(s.BannedCount) b.Comma() b.FieldStart("linked_chat_id") b.PutInt53(s.LinkedChatID) b.Comma() b.FieldStart("direct_messages_chat_id") b.PutInt53(s.DirectMessagesChatID) b.Comma() b.FieldStart("slow_mode_delay") b.PutInt32(s.SlowModeDelay) b.Comma() b.FieldStart("slow_mode_delay_expires_in") b.PutDouble(s.SlowModeDelayExpiresIn) b.Comma() b.FieldStart("can_enable_paid_messages") b.PutBool(s.CanEnablePaidMessages) b.Comma() b.FieldStart("can_enable_paid_reaction") b.PutBool(s.CanEnablePaidReaction) b.Comma() b.FieldStart("can_get_members") b.PutBool(s.CanGetMembers) b.Comma() b.FieldStart("has_hidden_members") b.PutBool(s.HasHiddenMembers) b.Comma() b.FieldStart("can_hide_members") b.PutBool(s.CanHideMembers) b.Comma() b.FieldStart("can_set_sticker_set") b.PutBool(s.CanSetStickerSet) b.Comma() b.FieldStart("can_set_location") b.PutBool(s.CanSetLocation) b.Comma() b.FieldStart("can_get_statistics") b.PutBool(s.CanGetStatistics) b.Comma() b.FieldStart("can_get_revenue_statistics") b.PutBool(s.CanGetRevenueStatistics) b.Comma() b.FieldStart("can_get_star_revenue_statistics") b.PutBool(s.CanGetStarRevenueStatistics) b.Comma() b.FieldStart("can_send_gift") b.PutBool(s.CanSendGift) b.Comma() b.FieldStart("can_toggle_aggressive_anti_spam") b.PutBool(s.CanToggleAggressiveAntiSpam) b.Comma() b.FieldStart("is_all_history_available") b.PutBool(s.IsAllHistoryAvailable) b.Comma() b.FieldStart("can_have_sponsored_messages") b.PutBool(s.CanHaveSponsoredMessages) b.Comma() b.FieldStart("has_aggressive_anti_spam_enabled") b.PutBool(s.HasAggressiveAntiSpamEnabled) b.Comma() b.FieldStart("has_paid_media_allowed") b.PutBool(s.HasPaidMediaAllowed) b.Comma() b.FieldStart("has_pinned_stories") b.PutBool(s.HasPinnedStories) b.Comma() b.FieldStart("gift_count") b.PutInt32(s.GiftCount) b.Comma() b.FieldStart("my_boost_count") b.PutInt32(s.MyBoostCount) b.Comma() b.FieldStart("unrestrict_boost_count") b.PutInt32(s.UnrestrictBoostCount) b.Comma() b.FieldStart("sticker_set_id") b.PutLong(s.StickerSetID) b.Comma() b.FieldStart("custom_emoji_sticker_set_id") b.PutLong(s.CustomEmojiStickerSetID) b.Comma() b.FieldStart("location") if err := s.Location.EncodeTDLibJSON(b); err != nil { return fmt.Errorf("unable to encode supergroupFullInfo#e57155ce: field location: %w", err) } b.Comma() b.FieldStart("invite_link") if err := s.InviteLink.EncodeTDLibJSON(b); err != nil { return fmt.Errorf("unable to encode supergroupFullInfo#e57155ce: field invite_link: %w", err) } b.Comma() b.FieldStart("bot_commands") b.ArrStart() for idx, v := range s.BotCommands { if err := v.EncodeTDLibJSON(b); err != nil { return fmt.Errorf("unable to encode supergroupFullInfo#e57155ce: field bot_commands element with index %d: %w", idx, err) } b.Comma() } b.StripComma() b.ArrEnd() b.Comma() b.FieldStart("bot_verification") if err := s.BotVerification.EncodeTDLibJSON(b); err != nil { return fmt.Errorf("unable to encode supergroupFullInfo#e57155ce: field bot_verification: %w", err) } b.Comma() b.FieldStart("upgraded_from_basic_group_id") b.PutInt53(s.UpgradedFromBasicGroupID) b.Comma() b.FieldStart("upgraded_from_max_message_id") b.PutInt53(s.UpgradedFromMaxMessageID) b.Comma() b.StripComma() b.ObjEnd() return nil } // DecodeTDLibJSON implements tdjson.TDLibDecoder. func (s *SupergroupFullInfo) DecodeTDLibJSON(b tdjson.Decoder) error { if s == nil { return fmt.Errorf("can't decode supergroupFullInfo#e57155ce to nil") } return b.Obj(func(b tdjson.Decoder, key []byte) error { switch string(key) { case tdjson.TypeField: if err := b.ConsumeID("supergroupFullInfo"); err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: %w", err) } case "photo": if err := s.Photo.DecodeTDLibJSON(b); err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: field photo: %w", err) } case "description": value, err := b.String() if err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: field description: %w", err) } s.Description = value case "member_count": value, err := b.Int32() if err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: field member_count: %w", err) } s.MemberCount = value case "administrator_count": value, err := b.Int32() if err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: field administrator_count: %w", err) } s.AdministratorCount = value case "restricted_count": value, err := b.Int32() if err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: field restricted_count: %w", err) } s.RestrictedCount = value case "banned_count": value, err := b.Int32() if err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: field banned_count: %w", err) } s.BannedCount = value case "linked_chat_id": value, err := b.Int53() if err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: field linked_chat_id: %w", err) } s.LinkedChatID = value case "direct_messages_chat_id": value, err := b.Int53() if err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: field direct_messages_chat_id: %w", err) } s.DirectMessagesChatID = value case "slow_mode_delay": value, err := b.Int32() if err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: field slow_mode_delay: %w", err) } s.SlowModeDelay = value case "slow_mode_delay_expires_in": value, err := b.Double() if err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: field slow_mode_delay_expires_in: %w", err) } s.SlowModeDelayExpiresIn = value case "can_enable_paid_messages": value, err := b.Bool() if err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: field can_enable_paid_messages: %w", err) } s.CanEnablePaidMessages = value case "can_enable_paid_reaction": value, err := b.Bool() if err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: field can_enable_paid_reaction: %w", err) } s.CanEnablePaidReaction = value case "can_get_members": value, err := b.Bool() if err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: field can_get_members: %w", err) } s.CanGetMembers = value case "has_hidden_members": value, err := b.Bool() if err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: field has_hidden_members: %w", err) } s.HasHiddenMembers = value case "can_hide_members": value, err := b.Bool() if err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: field can_hide_members: %w", err) } s.CanHideMembers = value case "can_set_sticker_set": value, err := b.Bool() if err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: field can_set_sticker_set: %w", err) } s.CanSetStickerSet = value case "can_set_location": value, err := b.Bool() if err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: field can_set_location: %w", err) } s.CanSetLocation = value case "can_get_statistics": value, err := b.Bool() if err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: field can_get_statistics: %w", err) } s.CanGetStatistics = value case "can_get_revenue_statistics": value, err := b.Bool() if err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: field can_get_revenue_statistics: %w", err) } s.CanGetRevenueStatistics = value case "can_get_star_revenue_statistics": value, err := b.Bool() if err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: field can_get_star_revenue_statistics: %w", err) } s.CanGetStarRevenueStatistics = value case "can_send_gift": value, err := b.Bool() if err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: field can_send_gift: %w", err) } s.CanSendGift = value case "can_toggle_aggressive_anti_spam": value, err := b.Bool() if err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: field can_toggle_aggressive_anti_spam: %w", err) } s.CanToggleAggressiveAntiSpam = value case "is_all_history_available": value, err := b.Bool() if err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: field is_all_history_available: %w", err) } s.IsAllHistoryAvailable = value case "can_have_sponsored_messages": value, err := b.Bool() if err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: field can_have_sponsored_messages: %w", err) } s.CanHaveSponsoredMessages = value case "has_aggressive_anti_spam_enabled": value, err := b.Bool() if err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: field has_aggressive_anti_spam_enabled: %w", err) } s.HasAggressiveAntiSpamEnabled = value case "has_paid_media_allowed": value, err := b.Bool() if err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: field has_paid_media_allowed: %w", err) } s.HasPaidMediaAllowed = value case "has_pinned_stories": value, err := b.Bool() if err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: field has_pinned_stories: %w", err) } s.HasPinnedStories = value case "gift_count": value, err := b.Int32() if err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: field gift_count: %w", err) } s.GiftCount = value case "my_boost_count": value, err := b.Int32() if err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: field my_boost_count: %w", err) } s.MyBoostCount = value case "unrestrict_boost_count": value, err := b.Int32() if err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: field unrestrict_boost_count: %w", err) } s.UnrestrictBoostCount = value case "sticker_set_id": value, err := b.Long() if err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: field sticker_set_id: %w", err) } s.StickerSetID = value case "custom_emoji_sticker_set_id": value, err := b.Long() if err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: field custom_emoji_sticker_set_id: %w", err) } s.CustomEmojiStickerSetID = value case "location": if err := s.Location.DecodeTDLibJSON(b); err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: field location: %w", err) } case "invite_link": if err := s.InviteLink.DecodeTDLibJSON(b); err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: field invite_link: %w", err) } case "bot_commands": if err := b.Arr(func(b tdjson.Decoder) error { var value BotCommands if err := value.DecodeTDLibJSON(b); err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: field bot_commands: %w", err) } s.BotCommands = append(s.BotCommands, value) return nil }); err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: field bot_commands: %w", err) } case "bot_verification": if err := s.BotVerification.DecodeTDLibJSON(b); err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: field bot_verification: %w", err) } case "upgraded_from_basic_group_id": value, err := b.Int53() if err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: field upgraded_from_basic_group_id: %w", err) } s.UpgradedFromBasicGroupID = value case "upgraded_from_max_message_id": value, err := b.Int53() if err != nil { return fmt.Errorf("unable to decode supergroupFullInfo#e57155ce: field upgraded_from_max_message_id: %w", err) } s.UpgradedFromMaxMessageID = value default: return b.Skip() } return nil }) } // GetPhoto returns value of Photo field. func (s *SupergroupFullInfo) GetPhoto() (value ChatPhoto) { if s == nil { return } return s.Photo } // GetDescription returns value of Description field. func (s *SupergroupFullInfo) GetDescription() (value string) { if s == nil { return } return s.Description } // GetMemberCount returns value of MemberCount field. func (s *SupergroupFullInfo) GetMemberCount() (value int32) { if s == nil { return } return s.MemberCount } // GetAdministratorCount returns value of AdministratorCount field. func (s *SupergroupFullInfo) GetAdministratorCount() (value int32) { if s == nil { return } return s.AdministratorCount } // GetRestrictedCount returns value of RestrictedCount field. func (s *SupergroupFullInfo) GetRestrictedCount() (value int32) { if s == nil { return } return s.RestrictedCount } // GetBannedCount returns value of BannedCount field. func (s *SupergroupFullInfo) GetBannedCount() (value int32) { if s == nil { return } return s.BannedCount } // GetLinkedChatID returns value of LinkedChatID field. func (s *SupergroupFullInfo) GetLinkedChatID() (value int64) { if s == nil { return } return s.LinkedChatID } // GetDirectMessagesChatID returns value of DirectMessagesChatID field. func (s *SupergroupFullInfo) GetDirectMessagesChatID() (value int64) { if s == nil { return } return s.DirectMessagesChatID } // GetSlowModeDelay returns value of SlowModeDelay field. func (s *SupergroupFullInfo) GetSlowModeDelay() (value int32) { if s == nil { return } return s.SlowModeDelay } // GetSlowModeDelayExpiresIn returns value of SlowModeDelayExpiresIn field. func (s *SupergroupFullInfo) GetSlowModeDelayExpiresIn() (value float64) { if s == nil { return } return s.SlowModeDelayExpiresIn } // GetCanEnablePaidMessages returns value of CanEnablePaidMessages field. func (s *SupergroupFullInfo) GetCanEnablePaidMessages() (value bool) { if s == nil { return } return s.CanEnablePaidMessages } // GetCanEnablePaidReaction returns value of CanEnablePaidReaction field. func (s *SupergroupFullInfo) GetCanEnablePaidReaction() (value bool) { if s == nil { return } return s.CanEnablePaidReaction } // GetCanGetMembers returns value of CanGetMembers field. func (s *SupergroupFullInfo) GetCanGetMembers() (value bool) { if s == nil { return } return s.CanGetMembers } // GetHasHiddenMembers returns value of HasHiddenMembers field. func (s *SupergroupFullInfo) GetHasHiddenMembers() (value bool) { if s == nil { return } return s.HasHiddenMembers } // GetCanHideMembers returns value of CanHideMembers field. func (s *SupergroupFullInfo) GetCanHideMembers() (value bool) { if s == nil { return } return s.CanHideMembers } // GetCanSetStickerSet returns value of CanSetStickerSet field. func (s *SupergroupFullInfo) GetCanSetStickerSet() (value bool) { if s == nil { return } return s.CanSetStickerSet } // GetCanSetLocation returns value of CanSetLocation field. func (s *SupergroupFullInfo) GetCanSetLocation() (value bool) { if s == nil { return } return s.CanSetLocation } // GetCanGetStatistics returns value of CanGetStatistics field. func (s *SupergroupFullInfo) GetCanGetStatistics() (value bool) { if s == nil { return } return s.CanGetStatistics } // GetCanGetRevenueStatistics returns value of CanGetRevenueStatistics field. func (s *SupergroupFullInfo) GetCanGetRevenueStatistics() (value bool) { if s == nil { return } return s.CanGetRevenueStatistics } // GetCanGetStarRevenueStatistics returns value of CanGetStarRevenueStatistics field. func (s *SupergroupFullInfo) GetCanGetStarRevenueStatistics() (value bool) { if s == nil { return } return s.CanGetStarRevenueStatistics } // GetCanSendGift returns value of CanSendGift field. func (s *SupergroupFullInfo) GetCanSendGift() (value bool) { if s == nil { return } return s.CanSendGift } // GetCanToggleAggressiveAntiSpam returns value of CanToggleAggressiveAntiSpam field. func (s *SupergroupFullInfo) GetCanToggleAggressiveAntiSpam() (value bool) { if s == nil { return } return s.CanToggleAggressiveAntiSpam } // GetIsAllHistoryAvailable returns value of IsAllHistoryAvailable field. func (s *SupergroupFullInfo) GetIsAllHistoryAvailable() (value bool) { if s == nil { return } return s.IsAllHistoryAvailable } // GetCanHaveSponsoredMessages returns value of CanHaveSponsoredMessages field. func (s *SupergroupFullInfo) GetCanHaveSponsoredMessages() (value bool) { if s == nil { return } return s.CanHaveSponsoredMessages } // GetHasAggressiveAntiSpamEnabled returns value of HasAggressiveAntiSpamEnabled field. func (s *SupergroupFullInfo) GetHasAggressiveAntiSpamEnabled() (value bool) { if s == nil { return } return s.HasAggressiveAntiSpamEnabled } // GetHasPaidMediaAllowed returns value of HasPaidMediaAllowed field. func (s *SupergroupFullInfo) GetHasPaidMediaAllowed() (value bool) { if s == nil { return } return s.HasPaidMediaAllowed } // GetHasPinnedStories returns value of HasPinnedStories field. func (s *SupergroupFullInfo) GetHasPinnedStories() (value bool) { if s == nil { return } return s.HasPinnedStories } // GetGiftCount returns value of GiftCount field. func (s *SupergroupFullInfo) GetGiftCount() (value int32) { if s == nil { return } return s.GiftCount } // GetMyBoostCount returns value of MyBoostCount field. func (s *SupergroupFullInfo) GetMyBoostCount() (value int32) { if s == nil { return } return s.MyBoostCount } // GetUnrestrictBoostCount returns value of UnrestrictBoostCount field. func (s *SupergroupFullInfo) GetUnrestrictBoostCount() (value int32) { if s == nil { return } return s.UnrestrictBoostCount } // GetStickerSetID returns value of StickerSetID field. func (s *SupergroupFullInfo) GetStickerSetID() (value int64) { if s == nil { return } return s.StickerSetID } // GetCustomEmojiStickerSetID returns value of CustomEmojiStickerSetID field. func (s *SupergroupFullInfo) GetCustomEmojiStickerSetID() (value int64) { if s == nil { return } return s.CustomEmojiStickerSetID } // GetLocation returns value of Location field. func (s *SupergroupFullInfo) GetLocation() (value ChatLocation) { if s == nil { return } return s.Location } // GetInviteLink returns value of InviteLink field. func (s *SupergroupFullInfo) GetInviteLink() (value ChatInviteLink) { if s == nil { return } return s.InviteLink } // GetBotCommands returns value of BotCommands field. func (s *SupergroupFullInfo) GetBotCommands() (value []BotCommands) { if s == nil { return } return s.BotCommands } // GetBotVerification returns value of BotVerification field. func (s *SupergroupFullInfo) GetBotVerification() (value BotVerification) { if s == nil { return } return s.BotVerification } // GetUpgradedFromBasicGroupID returns value of UpgradedFromBasicGroupID field. func (s *SupergroupFullInfo) GetUpgradedFromBasicGroupID() (value int64) { if s == nil { return } return s.UpgradedFromBasicGroupID } // GetUpgradedFromMaxMessageID returns value of UpgradedFromMaxMessageID field. func (s *SupergroupFullInfo) GetUpgradedFromMaxMessageID() (value int64) { if s == nil { return } return s.UpgradedFromMaxMessageID }